WebCraft

position: sticky (inline)

A wide table that keeps its first column

CitySessionsBouncePages
Auckland4 81261%2.4
Bergen3 19058%2.1
Cádiz2 77464%2.9
Dakar2 01549%1.8
Esbjerg1 64052%2.0
Faro1 28847%1.6
Galway1 00444%1.4

CaveatThe corner cell is sticky in two directions at once, so it has to outrank both the header row and the pinned column. Give it the highest z-index of the three or the scrolling cells paint straight over it.

FallbackEvery sticky cell needs its own opaque background. Sticky does not create a new layer, so without one the rows underneath show through as you scroll.

CSS
/* the frozen column */
.pin { position: sticky; left: 0; z-index: 1; }
thead th { position: sticky; top: 0; z-index: 2; }

/* both at once, so it beats both */
thead .pin { z-index: 3; }

Published