Module tablecell

Module tablecell 

Source
Expand description

Attribute names for table cell (<td>, <th>) elements.

§Purpose

Table data (<td>) and header (<th>) cells can span multiple rows or columns and be associated with headers for accessibility.

§Common Attributes

  • colspan: Number of columns the cell spans
  • rowspan: Number of rows the cell spans
  • headers: Space-separated list of header cell IDs
  • scope: Scope of header cell (row, col, rowgroup, colgroup)

§Example

<table>
  <tr>
    <th id="name" scope="col">Name</th>
    <th id="age" scope="col">Age</th>
  </tr>
  <tr>
    <td headers="name">Alice</td>
    <td headers="age">30</td>
  </tr>
  <tr>
    <td colspan="2">Merged cell across two columns</td>
  </tr>
</table>

§WHATWG Specification

Constants§

COLSPAN
The colspan attribute.
HEADERS
The headers attribute.
ROWSPAN
The rowspan attribute.
SCOPE
The scope attribute.