For a11y. <td> with scope="" is obsolete in HTML5. Only use it on th. If the first cell of your row doesn't have a scope relation to the other cells, use td without scope
Borders everywhere
Fannypack lovers
ID
First name
Last name
Role
1
Gwendolyn
Matthys
Visual designer
2
Yannick
Van Avermaet
Frontend Architect
3
Jochen
Vandendriessche
Frontend developer
4
Gregory
Van Looy
Frontend developer
Only horizontal borders
Fannypack lovers
#
First name
Last name
Role
1
Gwendolyn
Matthys
Visual designer
2
Yannick
Van Avermaet
Frontend Architect
3
Jochen
Vandendriessche
Frontend developer
4
Gregory
Van Looy
Frontend developer
Striped
Fannypack lovers
#
First name
Last name
Role
1
Gwendolyn
Matthys
Visual designer
2
Yannick
Van Avermaet
Frontend Architect
3
Jochen
Vandendriessche
Frontend developer
4
Gregory
Van Looy
Frontend developer
Simple tables with key - value pairs
Sometimes all you need to display is a table with some key-value pairs as data.
With .key or scope="row" you can emphasize the key. If you need extra styling
for the value , just add .value to that cell.
ID
12345
Last change
Not saved yet
Status
Draft
Condensed tables
Table cells with less spacing
Fannypack lovers
#
First name
Last name
Role
1
Gwendolyn
Matthys
Visual designer
2
Yannick
Van Avermaet
Frontend Architect
3
Jochen
Vandendriessche
Frontend developer
4
Gregory
Van Looy
Frontend developer
Responsive tables
Making a table responsive (with overflow) is very easy. Just add a div.table__wrapper around the table. If the content or the vast number of cells don’t fit the container, you get horizontal scrollbars. This is done with overflow.
Resize your browser to see the result.
Standard Responsive table
#
table heading
table heading
table heading
table heading
table heading
table heading
table heading
table heading
table heading
table heading
1
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
2
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
3
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
4
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
5
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
6
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
table cell
Selector
Description
.table__wrapper
Required
Wrapping div that adds horizontal scrollbars with overflow-x: auto
Transforming responsive table
On smaller screens the table transforms to blocks that are stacked and with accessible titles.
This requires a little more work than just CSS. You need to add the required
attributes to make this work and be accessible.
Transforming responsive table
#
First name
Last name
Role
1
Gwendolyn
Matthys
Visual designer
2
Yannick
Van Avermaet
Frontend Architect
3
Jochen
Vandendriessche
Frontend developer
4
Gregory
Van Looy
Frontend developer
Selector / Attribute
Description
.table--transformer
Required
Modifier class
data-title=""
Required
Creates a label for the corresponding value. Needs to be the same as the matching th