2017-06-15 99 views
0

enter image description here如何在html中使用colspan,rowspan或css創建表格?

如何使用HTML和CSS創建類似上述示例的表格。我試過以下內容:

<table> 
    <tr> 
    <th>XXX</th> 
    <th>XXX</th> 
    </tr> 
    <tr> 
    <td>XXX</td> 
    <td>XXX</td> 
    </tr> 
    <tr> 
    <td>XXX</td> 
    <td>XXX</td> 
    </tr> 
    <tr> 
    <td>XXX</td> 
    <td>XXX</td> 
    </tr> 
</table> 

但它不起作用。誰能幫忙?

+0

你需要使用colspan'和'rowspan'的'組合。 –

+0

瞭解有關使用'rowspan'和'colspan'的知識。這並不難理解。 [這裏是幫助](https://stackoverflow.com/a/9830847/5015089) –

+0

謝謝@HiddenHobbes和Mian Haseeb – Vasanth

回答

1

像這樣的事情

<table border="1" cellpadding="10" cellspacing="0" style="width:100%"> 
 
    <tr> 
 
    <td style="width:50%">&nbsp;</td> 
 
    <td colspan="2">&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 
    <td rowspan="2">&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td rowspan="2">&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 
    <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 
    <td rowspan="2">&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td rowspan="2">&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 
    <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 
    <td>&nbsp;</td> 
 
    <td colspan="2">&nbsp;</td> 
 
    </tr> 
 
</table>

+0

謝謝@abnishekPandey – Vasanth

0
<table> 
<tr> 
<th colspan="2">XXX</th> 
<th colspan="2">XXX</th> 
</tr> 
<tr> 
<td colspan="2">XXX</td> 
<td colspan="2">XXX</td> 
</tr> 
<tr> 
<td colspan="2">XXX</td> 
<td rowspan="2">XXX</td> 
</tr> 
<tr> 
<td colspan="2">XXX</td> 
<td>XXX</td> 
</tr> 
<tr> 
<td colspan="2">XXX</td> 
<td rowspan="2">XXX</td> 
</tr> 
<tr> 
<td>XXX</td> 
<td>XXX</td> 
</tr> 
<tr> 
<td colspan="2">XXX</td> 
<td rowspan="2">XXX</td> 
</tr> 

相關問題