Column Span
Sometimes we need the data in a table to span across multiple columns. For example, in a calendar, we may have an event that spans multiple hours.
We can achieve this using the colspan attribute with a value equal to the number of columns the data should span. Here's an example:
<body>
<table>
<tr>
<th>Monday</th>
<th>Tuesday</th>
</tr>
<tr>
<td colspan="2">Off</td>
</tr>
</table>
</body>The code above would be displayed as follows:
| Monday | Tuesday |
|---|---|
| Off | |
Instructions
Add the colspan attribute with a value of 2 to any th or td element.
Start programming for free
5/7