🖼️Data Table
Also known as Table (UI), Data Grid, Sortable Table
Facts set out in rows and columns. A top row names each column.
Think of it like
It is like a times table chart. Rows go across, columns go down, and each box has one fact.
Example
A shop owner sees orders in a table. She clicks the Price header to sort from highest to lowest.
Why it matters
It is the fastest way to compare many items field by field.
Definition
Example code
html
<table>
<thead><tr><th>Order</th><th>Price</th></tr></thead>
<tbody><tr><td>1042</td><td>$20</td></tr></tbody>
</table>Try it
| Kind | ||
|---|---|---|
| Wool socks | Socks | $12.00 |
| Water bottle | Kit | $18.00 |
| Running shoes | Shoes | $64.00 |
| Rain jacket | Coats | $110.00 |
Numbers line up on the right, so the eye can compare them without reading.
Sort by price. A table is the only one of the three you can read down a column.
Common mistake
Key takeaways
- 1Rows and columns. Each item, each field.
- 2Read down to compare. Sort by the header.
- 3Numbers to the right. Easy to line up.