Data table — striped rows, hover, sortable header
The table style every dashboard needs: striped rows, hover highlight, bold header, right-aligned numbers.
style.css
v3.1
style.css — the CSS rules
index.html — the HTML structure (what the CSS targets)
Live preview
updates as you type
🧠 How it works
border-collapse: collapse — removes the double-border between cells. Always use this for tables. overflow: hidden + border-radius — clips the header's background to the rounded corners. thead has a dark background, tbody is white — classic dashboard look. nth-child(even) — zebra stripes. Improves readability on wide tables. tr:hover — highlights the row the mouse is over. Helps users track across wide rows. td.num { text-align: right; font-family: monospace } — right-aligned monospace numbers are easier to compare. Badges (success/fail) use semi-transparent background + solid text color — looks modern without being heavy.
✏️ Try these changes
-
Change nth-child(even) to nth-child(odd)→ stripes flip — odd rows get the background -
Change the thead background from #1a1a1a to #a0c000→ header becomes green -
Change the hover background from rgba(160,192,0,0.08) to rgba(88,166,255,0.1)→ hover becomes blue -
Add .data-table td:first-child { font-weight: 600; }→ first column (model name) becomes bold -
Change text-transform: uppercase to none→ header text becomes normal case