0

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.

Tim567
  • 775
  • 1
  • 5
  • 22
  • Does this answer your question? [Table header to stay fixed at the top when user scrolls it out of view with jQuery](https://stackoverflow.com/questions/4709390/table-header-to-stay-fixed-at-the-top-when-user-scrolls-it-out-of-view-with-jque) – Tim567 May 29 '20 at 07:31
  • i have to use that in angular 7.0 i tried that code still not working – Arjun Nair May 29 '20 at 09:33
  • I need tbody of the table to be in fixed hight and inside that should be scrollable – Arjun Nair May 29 '20 at 09:40
  • Than this is your solution: https://stackoverflow.com/a/23989771/9863484 – Tim567 May 29 '20 at 10:04

0 Answers0