bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/HTML/HTML Foundations Practice
HTML•HTML Foundations Practice

HTML Table Colspan & Rowspan

Formula

HTML tables can have cells that span over multiple rows and/or columns.

Name

April

2022

Fiesta

Formula

HTML Table - Colspan

To make a cell span over multiple columns, use the colspan attribute:

Example

<table> <tr> <th colspan="2">Name</th>

Formula

< th > Age </th >

</tr> <tr>

Formula

< td > Jill </td >
< td > Smith </td >
< td > 43 </td >

</tr> <tr>

Formula

< td > Eve </td >
< td > Jackson </td >
< td > 57 </td >

</tr> </table>

Note:

The value of the colspan attribute represents the number of columns to span.

Formula

HTML Table - Rowspan

To make a cell span over multiple rows, use the rowspan attribute:

Example

<table> <tr>

Formula

< th > Name </th >
< td > Jill </td >

</tr> <tr> <th rowspan="2">Phone</th>

Formula

< td > 555 - 1234 </td >

</tr> <tr>

Formula

< td > 555 - 8745 </td >

</tr> </table>

Note:

The value of the rowspan attribute represents the number of rows to span.

Previous

HTML Table Borders

Next

HTML Tables Code Challenge