I'm trying to create a table with tbody
scrollable with thead
fixed but the main condition is width should be based on text length
.
I used following code but it have fixed width:
css:
thead, tbody tr {
display:table;
width:100%;
table-layout:fixed;/* even columns width , fix width of table too*/
}
tbody {
display:block;
max-height:60vh;
overflow:auto;
}
thead {
width: calc( 100% - 1em )
}
kindly provide a better solution for this problem.