I want a table to have a scrollable tbody, but headers should not scroll.
The table should not occupy 100% width. The columns should not be wider than the content.
How do I do that?
Trying at https://jsfiddle.net/vxmyh826/4/ to make it look like
With the css
table
{
border-collapse: collapse;
max-height: 200px;
display: inline-block;
}
tbody
{
max-height: 200px;
width: 100%;
display: inline-block;
overflow-y: scroll;
}
and it will rather look something like
with the table border marked with red.
edit
This is not a duplicate of the said link because I do not look for a solution that uses scripting (it is a css question).