+ 4
Is it legal to use both rowspan and colspan attribute in <td> tag at the same time?
eg. <td colspan=2 rowspan=3>hello</td>
3 Réponses
+ 5
Colspan is used for td (table data/column), and rowspan can only be used for tr (table row).
<table border="2">
<tr>
<td>Red</td>
<td>Blue</td>
<td>Green</td>
</tr>
<tr rowspan="2">
<tr>
<td>Brown</td>
</tr>
<td>Yellow</td>
<td colspan="2">Orange</td>
</tr>
</table>
/edit my bad, that is not how it works at all..
Rowspan is to span a row to 2 or more rows (vertically enlarge a row).
Colspan is to span a column to 2 or more columns (horizontally enlarge a column).
0
Agree with arif
0
<table border="2">
<tr>
<td>Red</td>
<td>Blue</td>
<td>Green</td>
</tr>
<tr>
<tr>
<td colspan="3">Brown</td>
</tr>
<td>Yellow</td>
<td colspan="2">Orange</td>
</tr>
</table>