How to make html table vertically scrollable

前端 未结 9 571
北荒
北荒 2020-12-24 10:39

see jsbin

I have to make my html table vertically scrollable.
I have used below code on tbody tag but its doesn\'t work for me

 <         


        
9条回答
  •  盖世英雄少女心
    2020-12-24 10:58

    I fought with this one for a while. My goal was to have a table with headers where the widths of the each header column was the the same as the corresponding body column and was the minimum size necessary to fit the data. also the body data was scrollable underneath header.

    I solved this by using divs and not tables. Each "table" was a div with the header being a div of divs and the body being a div of divs. I used the style as indicated by @sushil above. I added a bit of javascript/jQuery to balance the columns. Maybe 20-30 lines.

    Unfortunately I lost the code and have to rebuild it. I know this is a bit old, but maybe it will help someone else.

提交回复
热议问题