2010-05-10 48 views
1

我想創建圖像超鏈接到一些URL和超鏈接donot似乎工作。簡單的HTML問題與href

我使用的代碼下面給出的http://windchimes.co.in/index_w%20-%20Copy.html

你能告訴我爲什麼超鏈接的圖標不workking?

<td width="29" style="padding-bottom: 42px;><a href="http://windchimes.co.in/blog" target="_blank"><img align="middle" title="blog" alt="blog" src="http://dl.dropbox.com/u/529534/windchimes/icon-blog.gif"></a></td><td width="29" style="padding-bottom: 42px;> <a href="http://www.linkedin.com/groups?gid=120310" target="_blank"><img align="middle" title="linkedin" alt="linkedin" src="http://dl.dropbox.com/u/529534/windchimes/icon-linkedin.gif"></a></td><td width="29" style="padding-bottom: 42px;> <a href="http://www.facebook.com/group.php?gid=72425590275" target="_blank"><img align="middle" title="facebook" alt="facebook" src="http://dl.dropbox.com/u/529534/windchimes/icon-facebook.gif"></a></td><td width="29" style="padding-bottom: 42px;> <a href="http://twitter.com/windchimesindia" target="_blank"><img align="middle" title="twitter" alt="twitter" src="http://dl.dropbox.com/u/529534/windchimes/icon-twitter.gif"></a></td><td width="29" style="padding-bottom: 42px;> <a href="http://www.youtube.com/user/Windchimesindia" target="_blank"><img align="middle" title="Youtube" alt="Youtube" src="http://dl.dropbox.com/u/529534/windchimes/icon-youtube.gif"></a><td> 
+0

您的頁面沒有加載。鏈接會發生什麼? – 2010-05-10 07:31:57

回答

2

不知道如果有更多的,但你在缺少收盤行情:

<td width="29" style="padding-bottom: 42px;> 
              ^^^ 
+0

他們缺少每個'td'標籤。 – 2010-05-10 07:40:07

+0

耶找到了錯誤。這就對了。 – 2010-05-10 07:43:25

0

您最後的<td>標記未正確關閉。

<td width="29" style="padding-bottom: 42px;> 
... 
<td> 

</td>代替<td>在末端。

2

如果您執行以下操作,診斷,維護和調整您的網頁會更容易。

  1. 保持你的關注點分開 - 你的HTML應該描述一個文檔,而不是它的風格。將您的樣式規則放入級聯樣式表(CSS)中,這也意味着您將滿足下一個規則
  2. 不要重複自己。所有這些元素的寬度和樣式規則完全相同。這意味着如果你想把寬度改成30px,你必須找到/替換每一個這些項目(如果你自動化你的查找和替換,你必須希望你不會意外替換你並不意味着的東西
  3. 佈局您的代碼 - 通過正確地標記您的HTML代碼,您將發現錯誤的結尾標記,因爲它會立即出現錯誤的眼睛
  4. 使用validator.w3.org以確保代碼是正確的 - 這一定會發現你的錯誤,並會幫助您避免在您的代碼中的兩個問題 - 缺少報價,而遺漏的結束標記

這裏是你的代碼的乾淨版本...

CSS:

td.myClass { 
    width: 29px; 
    padding-bottom: 42px; 
    text-align: center; 
} 

和HTML:

<td style="myClass"> 
    <a href="http://windchimes.co.in/blog" target="_blank"> 
     <img title="blog" alt="blog" src="http://dl.dropbox.com/u/529534/windchimes/icon-blog.gif"> 
    </a> 
</td> 
<td style="myClass"> 
    <a href="http://www.linkedin.com/groups?gid=120310" target="_blank"> 
     <img title="linkedin" alt="linkedin" src="http://dl.dropbox.com/u/529534/windchimes/icon-linkedin.gif"> 
    </a> 
</td> 
<td style="myClass"> 
    <a href="http://www.facebook.com/group.php?gid=72425590275" target="_blank"> 
     <img title="facebook" alt="facebook" src="http://dl.dropbox.com/u/529534/windchimes/icon-facebook.gif"> 
    </a> 
</td> 
<td style="myClass"> 
    <a href="http://twitter.com/windchimesindia" target="_blank"> 
     <img title="twitter" alt="twitter" src="http://dl.dropbox.com/u/529534/windchimes/icon-twitter.gif"> 
    </a> 
</td> 
<td style="myClass"> 
    <a href="http://www.youtube.com/user/Windchimesindia" target="_blank"> 
     <img title="Youtube" alt="Youtube" src="http://dl.dropbox.com/u/529534/windchimes/icon-youtube.gif"> 
    </a> 
</td>