2013-08-23 26 views
-3

Sample fail lol如何在2行中遍歷所有th/td?

但我要的是有第一thead tr跨越未來tr這在例子是空的跨越。 有什麼建議嗎?

我基本上想要一個標題行,它是的兩倍正常行的高度(動態)。

+2

定義 –

+1

「的標準行的高度」當你說你想要的每列行跨越下一行的相應列意味着,你實際上意味着你只需要一行。有人可以幫助我在這裏沒有正確解釋嗎? :( – Prash

回答

0

您正在使用行跨度=「2正確「 檢查你的代碼很少修改:

<table> 
<thead> 
    <tr> 
     <th rowspan="2">header 1</th> 
     <th rowspan="2">header 2</th> 
     <th rowspan="2">header 3</th> 
     <th>header 4</th> 
    </tr> 
    <tr> 
     <th>header 5</th> 
    </tr> 
</thead> 
<tbody>enter code here 
</tbody> 

在您例如第一<tr>沒有任何高度,使日行跨度有沒有明顯的效果......

0

我想你需要添加borderspacing = '0' 表像這樣

<table cellspacing='0'> 
    <thead> 
     <tr> 
      <th rowspan="2">header 1</th> 
      <th rowspan="2">header 2</th> 
      <th rowspan="2">header 3</th> 
     </tr> 
     <tr> 

     </tr> 
    </thead> 
    <tbody> 
    </tbody> 
</table> 

和CSS:

th, td { 
    border: 1px solid blue; 
    height: 20px; 
} 

http://jsfiddle.net/Hive7/GRPzU/5/