Skip to content

Instantly share code, notes, and snippets.

@luismartinezs
Last active September 4, 2022 14:44
Show Gist options
  • Save luismartinezs/019d03a815b4db21c0fd3753b8e3c396 to your computer and use it in GitHub Desktop.
Save luismartinezs/019d03a815b4db21c0fd3753b8e3c396 to your computer and use it in GitHub Desktop.
A11y table #a11y
<!-- Use <caption> -->
<!-- Use scopes (enough for most cases) or ids and headers -->
<!-- Example with scopes -->
<table>
<caption>
Color names and values
</caption>
<tbody>
<tr>
<!-- scope="col" indicates that element is at the top of a column -->
<th scope="col">Name</th>
<th scope="col">HEX</th>
<th scope="col">HSLa</th>
<th scope="col">RGBa</th>
</tr>
<tr>
<!-- scope="row" indicates that element is the first of a row -->
<th scope="row">Teal</th>
<td><code>#51F6F6</code></td>
<td><code>hsla(180, 90%, 64%, 1)</code></td>
<td><code>rgba(81, 246, 246, 1)</code></td>
</tr>
<tr>
<th scope="row">Goldenrod</th>
<td><code>#F6BC57</code></td>
<td><code>hsla(38, 90%, 65%, 1)</code></td>
<td><code>rgba(246, 188, 87, 1)</code></td>
</tr>
</tbody>
</table>
<!-- Example with ids and headers -->
<thead>
<tr>
<th id="purchase">Purchase</th>
<th id="location">Location</th>
<th id="date">Date</th>
<th id="evaluation">Evaluation</th>
<th id="cost">Cost (€)</th>
</tr>
</thead>
<tbody>
<tr>
<th id="haircut">Haircut</th>
<td headers="location haircut">Hairdresser</td>
<td headers="date haircut">12/09</td>
<td headers="evaluation haircut">Great idea</td>
<td headers="cost haircut">30</td>
</tr>
</tbody>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment