2013-05-03 75 views
0

對於此代碼,當我在第三個表格行中添加文本時,它將廢棄所有相鄰單元格的佈局。請幫忙。html表格單元格文字搞亂了一切

謝謝

<table width="720" bgcolor="white" height="650" align="center" cellpadding="10" border="1"> 
    <tr valign="top"> 
     <td colspan="8" height="70" align="center"><img src="yooo.gif" align="middle" /> </td> </tr> 
    <tr height="40"> 
     <td colspan="2" align="center" width="175">Home</td> 
     <td colspan="2" align="center" width="175">Food</td> 
     <td colspan="2" align="center" width="175">Hobbies</td> 
     <td colspan="2" align="center" width="175">Martin's Blog</td> </tr> 
    <tr height="260"> 
     <td class="info" colspan="4" valign="top"><h2>Welcome to Nenad's Blog!!!</h2><h6>Here on this blog we will be talking about 
     a bunch of random stuff that are so completely unrelated that will blow your mind.<h6></td> 
     <td class="info" colspan="4"> h </td> </tr> 
    <tr height="260"> 
     <td class="info" colspan="4"> h </td> 
     <td class="info" colspan="4"> h </td> </tr> 
+1

這聽起來很愚蠢,但由於它不在代碼中,您是否正在關閉

標記? – 2013-05-03 02:39:43

+0

你能通過屏幕截圖向我們展示你期待的結果嗎? – TNK 2013-05-03 02:42:24

+0

我的桌子是關閉的:)我想將文字佔用一半的區域分成4等分方框 – fifiman 2013-05-03 02:44:32

回答

0

你的表看起來從我可以讓你貼什麼好。

但是,您應該不使用表格進行佈局。他們應該只用於表格數據,你知道......像電子表格。

對於造型您的網站,你應該使用CSS。

http://jsfiddle.net/3rJv7/

Code Runs 
0

您可能必須定義什麼是 「毀滅」 的意思。然而,我最好的猜測是,所有的colspans都會導致一些瀏覽器很難計算最佳列寬。我發現如果你的第一行定義了寬度,許多瀏覽器會更好地處理它,即使它是一個間隔圖像的虛擬行。我知道,在語義上很糟糕,但使用表格進行佈局往往是這樣。

+0

寬度似乎不是問題。身高只是瘋狂 – fifiman 2013-05-03 02:46:34

+0

好吧。修復行高可以是iffy,但看看這個問題:http://stackoverflow.com/questions/2092696/how-to-fix-height-of-tr – 2013-05-03 04:26:46