← All elements

Frozen First Column Table

by @admin · 0 views

<div class="fz" tabindex="0" role="region" aria-label="Plan prices, scrollable"><table><thead><tr><th>Plan</th><th>Monthly</th><th>Yearly</th><th>Seats</th><th>Storage</th><th>Support</th></tr></thead><tbody><tr><th>Solo</th><td>$6</td><td>$60</td><td>1</td><td>10 GB</td><td>Email</td></tr><tr><th>Team</th><td>$18</td><td>$180</td><td>8</td><td>100 GB</td><td>Chat</td></tr><tr><th>Studio</th><td>$42</td><td>$420</td><td>25</td><td>500 GB</td><td>Phone</td></tr><tr><th>Campus</th><td>$90</td><td>$900</td><td>80</td><td>2 TB</td><td>Priority</td></tr><tr><th>Network</th><td>$160</td><td>$1,600</td><td>200</td><td>5 TB</td><td>Priority</td></tr></tbody></table></div>

About this table

A wide table that scrolls sideways while the first column and header row stay in place with sticky cells.

How it works

The wrapper scrolls in both directions. Header cells use position: sticky at the top and the first cell of each body row sticks to the left, with higher stacking for the top left corner. Separate borders keep the lines attached to the sticky cells.

Ways to customise it

  • Change the wrapper height and width.
  • Add columns to see more sideways scrolling.
  • Change the header and first column colours.

Good to know

The scroll region is focusable and labelled for keyboard users. Sticky cells need an opaque background, or scrolled content will show through them.

Open an example, copy the HTML and the CSS, and paste them into your page. There is nothing to install and no JavaScript to load.

More in Tables

View all →