Tables

Examples for opt-in styling of tables (given their prevalent use in JavaScript plugins) with Bootstrap.

Basic Tables

Using the most basic table markup, here’s how .table look in Bootstrap. All table styles are inherited in Bootstrap, meaning any nested tables will be styled in the same manner as the parent.

# Track Length
1 Japanese Suite (1915) Op.33 10:21
2 Cotswolds Symphony (1900) Op.8 23:17
3 Sonata B flat major, K 358 21:07
4 Theme of Paganini, Op. 43 23:38
5 Cello Sonata in G minor 34:27

Table colours

You can also invert the colors—with light text on dark backgrounds—with .table-dark.

# Track Length
1 Japanese Suite (1915) Op.33 10:21
2 Cotswolds Symphony (1900) Op.8 23:17
3 Sonata B flat major, K 358 21:07
4 Theme of Paganini, Op. 43 23:38
5 Cello Sonata in G minor 34:27

Table head options

Use css variables --bs-table-bg and --bs-table-color to make <thead>s appear light or dark.

# Track Length Edit
1 Japanese Suite (1915) Op.33 10:21
2 Cotswolds Symphony (1900) Op.8 23:17
3 Sonata B flat major, K 358 21:07
4 Theme of Paganini, Op. 43 23:38
5 Cello Sonata in G minor 34:27

Striped Rows

Use .table-striped to add zebra-striping to any table row within the <tbody>.

# Track Length Edit
1 Japanese Suite (1915) Op.33 10:21
2 Cotswolds Symphony (1900) Op.8 23:17
3 Sonata B flat major, K 358 21:07
4 Theme of Paganini, Op. 43 23:38
5 Cello Sonata in G minor 34:27

Bordered Table

Add .table-bordered for borders on all sides of the table and cells.

# Track Length Edit
1 Japanese Suite (1915) Op.33 10:21
2 Cotswolds Symphony (1900) Op.8 23:17
3 Sonata B flat major, K 358 21:07
4 Theme of Paganini, Op. 43 23:38
5 Cello Sonata in G minor 34:27

Borderless Table

Add .table-borderless for a table without borders.

# Track Length Edit
1 Japanese Suite (1915) Op.33 10:21
2 Cotswolds Symphony (1900) Op.8 23:17
3 Sonata B flat major, K 358 21:07
4 Theme of Paganini, Op. 43 23:38
5 Cello Sonata in G minor 34:27

Hover Effect

Add .table-hover to enable a hover state on table rows within a <tbody>.

# Track Length Edit
1 Japanese Suite (1915) Op.33 10:21
2 Cotswolds Symphony (1900) Op.8 23:17
3 Sonata B flat major, K 358 21:07
4 Theme of Paganini, Op. 43 23:38
5 Cello Sonata in G minor 34:27

Contextual Classes

Use contextual classes to color table rows or individual cells.

# Track Length Edit
1 Japanese Suite (1915) Op.33 10:21
2 Cotswolds Symphony (1900) Op.8 23:17
3 Sonata B flat major, K 358 21:07
4 Theme of Paganini, Op. 43 23:38
5 Cello Sonata in G minor 34:27

Condensed Tables

Add .table-sm to make tables more compact by cutting cell padding in half.

# Track Length Edit
1 Japanese Suite (1915) Op.33 10:21
2 Cotswolds Symphony (1900) Op.8 23:17
3 Sonata B flat major, K 358 21:07
4 Theme of Paganini, Op. 43 23:38
5 Cello Sonata in G minor 34:27

Full Card Width

Place tables as a child of .card to make tables fill a cards full width.

# Track Length Edit
1 Japanese Suite (1915) Op.33 10:21
2 Cotswolds Symphony (1900) Op.8 23:17
3 Sonata B flat major, K 358 21:07
4 Theme of Paganini, Op. 43 23:38
5 Cello Sonata in G minor 34:27

Responsive Data Tables

Responsive tables allow tables to be scrolled horizontally with ease. Make any table responsive across all viewports by wrapping a .table with .table-responsive or pick a maximum breakpoint with which to have a responsive table up to by using .table-responsive{-sm|-md|-lg|-xl}.

Use .be-table-responsive instead of .table-responsive as you may get problems with dropdowns.

User Domain Storage Status Renewal
Avatar example.com Owner
Used
42GB / 100GB
Active May 15, 2019 £54.99 (Incl. VAT)
Avatar cdn.example.com User 0GB / 100GB Used
Inactive - £0 (Incl. VAT)
Avatar wordpress.example.com User 84GB / 100GB Used
Active June 28, 2019 £54.99 (Incl. VAT)