<td colspan="" rowspan="">

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O

The colspan attribute of the TD (TH) element specifies the number of columns spanned by the cell, and the rowspan attribute specifies the number of rows spanned by the cell.


<td colspan="3" rowspan="3"></td>

Attribute Value Explanation
colspan=" " number number of cols spanned by cell
rowspan=" " number number of rows spanned by cell

Example

Column spanning

<table border="1">
<tr>
<td colspan="3">Column spanning</td>
</tr>
<tr>
<td>Col1</td>
<td>Col2</td>
<td>Col3</td>
</tr>
</table>

Output
Column spanning
Col1 Col2 Col3
Row spanning

<table border="1">
<tr>
<td rowspan="3">Row spanning</td>
<td>Row1</td>
</tr>
<tr>
<td>Row2</td>
</tr>
<tr>
<td>Row3</td>
</tr>
</table>

Output
Row spanning Row1
Row2
Row3
Column and Row spanning

<table border="1">
<tr>
<td colspan="3" rowspan="3">Column and Row spanning</td>
<td>Row1 - Col4</td>
</tr>
<tr>
<td>Row2 - Col4</td>
</tr>
<tr>
<td>Row3 - Col4</td>
</tr>
<tr>
<td>Row4 - Col1</td>
<td>Row4 - Col2</td>
<td>Row4 - Col3</td>
<td>Row4 - Col4</td>
</tr>
</table>

Output
Column and Row spanning Row1 - Col4
Row2 - Col4
Row3 - Col4
Row4 - Col1 Row4 - Col2 Row4 - Col3 Row4 - Col4