nercone.devaboutlinkscontactsitemap
aboutlinkssitemap82ffc6419

Tables

Tables and their variants, defined in table.css.

Basic

Applies to <table>. Add the table class to other elements. Header cells in <thead> have a background; <th> elsewhere is semibold without one. <caption> is placed below the table.

Components and their files
ComponentStylesheetScript
Buttonbutton.cssNone
Sliderslider.cssslider.js
Popuppopup.csspopup.js

Variants

table-bordered draws a border around every cell. table-striped gives every second row a background, and table-hover highlights the row under the pointer. They can be combined.

HueAngleWhitenessBlackness
red020%0%
orange2520%0%
yellow5020%0%
green15520%0%
cyan19020%0%
sky21020%0%
blue23020%0%
purple27020%0%
pink32020%0%
<table class="table-striped table-hover">…</table>

Numeric cells

Cells with table-numeric are aligned to the end and use tabular figures, so digits line up.

ItemNormaltable-numeric
One1.001.00
Eleven11.1111.11
Thousand1,000.001,000.00

Horizontal scrolling

Wrap a wide table in table-scroll to scroll the table instead of the page. The table is at least as wide as the container.

Nameredorangeyellowgreencyanskybluepurplepink
dark--color-red-dark--color-orange-dark--color-yellow-dark--color-green-dark--color-cyan-dark--color-sky-dark--color-blue-dark--color-purple-dark--color-pink-dark
normal--color-red-normal--color-orange-normal--color-yellow-normal--color-green-normal--color-cyan-normal--color-sky-normal--color-blue-normal--color-purple-normal--color-pink-normal
bright--color-red-bright--color-orange-bright--color-yellow-bright--color-green-bright--color-cyan-bright--color-sky-bright--color-blue-bright--color-purple-bright--color-pink-bright
<div class="table-scroll">
    <table>…</table>
</div>

Customization

Change the cell padding with --table-padding (default 8px 12px) and the colors with --color-table-*.

CompactValue
One1
Ten10
Hundred100
.compact {
    --table-padding: 4px 8px;
    --color-table-header-background: var(--color-blue-opacity-20);
}