2013-03-12 47 views
3

我正在創建HTML時事通訊,我需要顯示一些帶有指定高度,寬度和塊級別顯示的空錨鏈接,但Gmail似乎已刪除空的<a>鏈接,所以我把&nbsp;在鏈接和它的作品像一個魅力,但它呈現&nbsp;作爲-字符。爲什麼非休息空間( )正在轉換爲破折號字符( - )

我查了Mozilla Firefox和谷歌瀏覽器,兩個瀏覽器都存在問題。有任何想法嗎?

代碼示例:

<table cellpadding="0" cellspacing="0" width="100%"> 
    <tbody> 
     <tr> 
      <td height="42" width="49" style="height: 42px; width: 49px"></td> 
      <td height="42" width="123" style="height: 42px; width: 123px"> 
       <a href="http://www.youtube.com/user/adsf" style="display: block; height: 42px; width: 123px">&nbsp;</a> 
      </td> 
      <td height="42" width="79" style="height: 42px; width: 79px"> 
       <a href="http://asdf.asdf.dsf" style="display: block; height: 42px; width: 79px">&nbsp;</a> 
      </td> 
      <td height="42" width="129" style="height: 42px; width: 129px"> 
       <a href="https://www.facebook.com/asdfasdf" style="display: block; height: 42px; width: 129px">&nbsp;</a> 
      </td> 
      <td height="42" width="111" style="height: 42px; width: 111px"> 
       <a href="https://twitter.com/adfdasff" style="display: block; height: 42px; width: 111px">&nbsp;</a> 
      </td> 
      <td height="42" width="269" style="height: 42px; width: 269px"></td> 
     </tr> 
    </tbody> 
</table> 

更新:它無關的Gmail,在我的HTML項目中存在的問題太多。

更新2:這是text-decoration問題,謝謝大家的好意。

+1

請張貼一些代碼。 – j08691 2013-03-12 16:52:26

+1

你確定它不只是在空白處看到的「文字裝飾:下劃線」嗎?嘗試在這些定位標記上添加'style =「text-decoration:none;」'。 – 2013-03-12 16:53:10

+1

這是一封電子郵件的HTML嗎? – Lowkase 2013-03-12 16:53:11

回答

5

我想象的問題是,空間是強調,就像一個鏈接通常會。您必須設置text-decoration才能停止此操作。

因爲它是一個HTML簡訊,我想你想這樣做在線:

<a style="text-decoration: none;">&nbsp;</a> 
1

默認情況下,錨標籤添加

a { text-decoration: none; } 

或添加內聯

<a href="path" style=" text-decoration: none;"> &nbsp; </a> 

text-decoration: underline;

+0

我已將您的答案標記爲已接受,但請注意,Gmail等一些電子郵件客戶端不允許您使用css。所有的可能性都是使用屬性或內聯樣式。 – 2013-03-12 17:08:37

+0

這可能有所幫助:http://www.campaignmonitor.com/css/ – 2013-03-12 17:09:28

3

你有三種解決方法:

使用<br/><a>元素即內:

<a href="#"><br/></a> 

,如果你想控制元素的高度使用:

<a href="#" style="height:20px;overflow:hidden;"><br/></a> 

使用text-decoration:none&nbsp;

<a href="#" style="text-decoration:none;">&nbsp;</a> 

3-使用text-indentheightwidth

<a href="#" style="text-indent:999px;width:0px;height:0px;overflow:hidden;">&nbsp;</a> 
+0

謝謝,但這將創建一個換行符,我的元素高度不會像我想要的那樣。 – 2013-03-12 16:56:44

+0

@faridv定義你的身高!我可以看到我的代碼,但電子郵件客戶端呈現頁面的方式不同,爲了確保它能顯示我想要顯示的內容,我必須添加更多樣式,例如'line-line style ='style =「height:20px;'' – shnisaka 2013-03-12 16:57:34

+0

'高度「和」溢出「,因爲我目前正在處理的巨大代碼,所以恐怕不是一個好的解決方案。由於html大小和大量複雜的代碼。 – 2013-03-12 17:01:34