css - html table with vertical scroll inside tbody -


i trying vertical scroll bar inside tbody fixed header. tried solution provided in link.

html table 100% width, vertical scroll inside tbody

table { width: 100%; border-spacing: 0; }  thead, tbody, tr, th, td { display: block; }  thead tr { /* fallback */ width: 97%; /* minus scroll bar width */ width: -webkit-calc(100% - 16px); width:    -moz-calc(100% - 16px); width:         calc(100% - 16px); }  tr:after {  /* clearing float */ content: ' '; display: block; visibility: hidden; clear: both; }  tbody { height: 100px; overflow-y: auto; overflow-x: hidden; }  tbody td, thead th { width: 19%;  /* 19% less (100% / 5 cols) = 20% */ float: left; } 

it works fine if scroll bar appears.but if rows few , scroll bar doesn't appear, thead not aligned tbody. how can fix issue css?

enter image description here

once tbody data move-out assigned height, y-axis get's activated.

 tbody {         height: 50px;         display: inline-block;         width: 100%;         overflow-y:scroll;     } 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -