Skip to content

Instantly share code, notes, and snippets.

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 IgorGavrilenko/94c9659a84e746925ccabdfcb87c7bd1 to your computer and use it in GitHub Desktop.
Save IgorGavrilenko/94c9659a84e746925ccabdfcb87c7bd1 to your computer and use it in GitHub Desktop.
фиксированные колнки и шапка в таблице
div {
max-width: 40em;
max-height: 20em;
overflow: scroll;
position: relative;
}
table {
position: relative;
border-collapse: collapse;
}
td,
th {
padding: 0.25em;
}
thead th {
position: -webkit-sticky; /* for Safari */
position: sticky;
top: 0;
background: #000;
color: #FFF;
}
thead th:first-child {
left: 0;
z-index: 1;
}
tbody th {
position: -webkit-sticky; /* for Safari */
position: sticky;
left: 0;
background: #FFF;
border-right: 1px solid #CCC;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment