Skip to content

Instantly share code, notes, and snippets.

@johncip
Last active April 21, 2016 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johncip/1a831a302ad99044727fac88aff67717 to your computer and use it in GitHub Desktop.
Save johncip/1a831a302ad99044727fac88aff67717 to your computer and use it in GitHub Desktop.
Pure-CSS fixed table headers
table.fixed-header
table-layout: fixed
border-collapse: collapse
thead tr
display: block
position: relative
tbody
display: block
overflow: auto
width: 100%
height: $table-body-height
// (need to specify table & column widths)
td, th
&:nth-child(1)
min-width: $col-1-width
&:nth-child(2)
min-width: $col-2-width
// ...
&:last-child
width: 100%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment