2015-11-07 31 views
0

我需要在HTML中創建這個形狀。 我剛剛瞭解了colspan和rowspan,但是這讓我吃驚...... 感謝您的幫助。如何操縱桌子到這個形狀?

表: enter image description here

+0

你需要一個表這樣的,或者你需要使用的帆布畫呢? http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_td_rowspan – pelya

回答

0

不能合併像倒L形的TD。相反,這可以通過調整邊框樣式來完成。

table { 
 
border-collapse: collapse; 
 
}
<table width="300" border="1px"> 
 
<tr> 
 
    <td colspan="2" height="30" style="border-bottom: 0"> 
 
     &nbsp; 
 
    </td> 
 
</tr> 
 
<tr> 
 
    <td width="30" style="border-top: 0"> 
 
     &nbsp; 
 
    </td> 
 
    <td height="200"> 
 
     &nbsp; 
 
    </td> 
 
</tr> 
 
</table>

+0

非常感謝您的幫助。 –

0

沒有rowspancolspan:first-child+選擇也可以幫助你。

no matters the numbers of row or column ;)

table { 
 
    border-collapse:collapse; 
 
    border:solid; 
 
} 
 
th, td { 
 
    min-width:3em; 
 
    height:3em; 
 
} 
 

 
tr td:first-child { 
 
    border-right:solid; 
 
} 
 
th + th { 
 
    border-bottom:solid 
 
}
<table> 
 
\t <thead> 
 
\t \t <tr> 
 
\t \t \t <th></th> 
 
\t \t \t <th></th> 
 
\t \t \t <th></th> 
 
\t \t \t <th></th> 
 
\t \t </tr> 
 
\t </thead> 
 
\t <tbody> 
 
\t \t <tr> 
 
\t \t \t <td></td> 
 
\t \t \t <td></td> 
 
\t \t \t <td></td> 
 
\t \t \t <td></td> 
 
\t \t </tr> 
 
\t \t <tr> 
 
\t \t \t <td></td> 
 
\t \t \t <td></td> 
 
\t \t \t <td></td> 
 
\t \t \t <td></td> 
 
\t \t </tr> 
 
\t \t <tr> 
 
\t \t \t <td></td> 
 
\t \t \t <td></td> 
 
\t \t \t <td></td> 
 
\t \t \t <td></td> 
 
\t \t </tr> 
 
\t </tbody> 
 
</table>