Search
 
SCRIPT & CODE EXAMPLE
 

CSS

scroll tbody fixed thead

table {
  width: 100%;
}

table, td {
  border-collapse: collapse;
  border: 1px solid #000;
}

thead {
  display: table; /* to take the same width as tr */
  width: calc(100% - 17px); /* - 17px because of the scrollbar width */
}

tbody {
  display: block; /* to enable vertical scrolling */
  max-height: 200px; /* e.g. */
  overflow-y: scroll; /* keeps the scrollbar even if it doesn't need it; display purpose */
}

th, td {
  width: 33.33%; /* to enable "word-break: break-all" */
  padding: 5px;
  word-break: break-all; /* 4. */
}

tr {
  display: table; /* display purpose; th's border */
  width: 100%;
  box-sizing: border-box; /* because of the border (Chrome needs this line, but not FF) */
}

td {
  text-align: center;
  border-bottom: none;
  border-left: none;
}
Comment

PREVIOUS NEXT
Code Example
Css :: text align left in span 
Css :: visibility 
Css :: flex max slang meaning 
Css :: why are suacer pans made of bakelite 
Css :: glass div generator 
Css :: white rgb 
Css :: transition prefixes css 
Css :: how to stop browser from swipe left to right history-navigation javascript 
Css :: display none transition 
Css :: how to make a div fill the screen 
Css :: css background full screen 
Css :: a tag taking up all the width of the page 
Css :: change color to white svg with filter 
Css :: how to put the input box and the label on top of input 
Css :: check if audio element is playing css 
Css :: css invert text color 
Css :: secondline ellipsis 
Css :: css stretch font vertically 
Css :: text area resize css 
Css :: css clearfix 
Css :: How to remove horizontal scrollbar and yet allow vertical 
Css :: hover effect button css 
Css :: css orange color 
Css :: text in centre table css 
Css :: opacity color 
Css :: border radius 4 values 
Css :: html how to use a background image fill not stretch 
Css :: input rtl html 
Css :: how to disable margin collapsing 
Css :: css background transparency or alpha mode 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =