CSS on a table: scope="row"

On the above page, MDN uses scope=“row” for the th in the code below. Why isn’t it used on the tr instead? After all, that defines the row.

    <tr>
      <th scope="row">The Clash</th>
      <td>1976</td>
      <td>6</td>
      <td>London Calling</td>
    </tr>

Because it’s referring specifically to the th element, saying that it is the header for that specific row. If you look above that, there are the headers for each table column.

scope is a tool for screen readers and has no visual impact as it’s intended for accessibility purposes.

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.