Can the `colspan` attribute only be used within `<td>` tags?


#1

Question

Can the colspan attribute only be used within <td> tags?

Answer

No. The colspan attribute can also be used on <th> tags. For improved accessibility, when we create table headings that span multiple columns, we should also include the scope=”colgroup” attribute within the opening <th> tag.


FAQ: Learn HTML Tables - Tables - Spanning Columns