Created
February 25, 2021 21:55
-
-
Save IgorGavrilenko/94c9659a84e746925ccabdfcb87c7bd1 to your computer and use it in GitHub Desktop.
фиксированные колнки и шапка в таблице
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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