+ 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>

23rd Nov 2016, 12:58 PM
Dipak Kumar Prasad
Dipak Kumar Prasad - avatar
3 Answers
+ 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).
23rd Nov 2016, 6:30 PM
Arif - avatar
Agree with arif
25th Nov 2016, 8:06 PM
Alex King
Alex King - avatar
<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>
28th Nov 2016, 10:09 AM
Jitesh Mohape
Jitesh Mohape - avatar