css - HTML scrollable table header and body alignment -
css - HTML scrollable table header and body alignment -
i've spent great deal of time , effort on toying , researching this, cannot figure out how align column headers scrollable table body in html. there other solutions , techniques posted on here , @ random places on web, yielded inconsistent results, random amounts of data.
here's jsfiddle.
note have custom css applied, bootstrap's css. please expand result panel big plenty html headers not wrap.
to summarize html, there 2 tables - 1 column headers, 1 info cells. each wrapped in <div>
, allows cells scrollable , sets width of columns. business relationship scroll bar showing (the info dynamic , have no thought how much info there be), <div>
wrapper around table cells set show scroll bar, , wrapper around table headers has css applied:
.grid-container .column-wrapper { width: calc(100% - 16px); /* 16px approximate width of scroll bar */ }
this works on monitor when zoom 100%, on other monitors, grid lines not aligned - off maybe 4px. application uses these grids uses them extensively, of align while others off. unfortunately have not found pattern render correctly , not.
i not want javascript solution - these grids have lot of javascript applied create them interactive , render huge amounts of info (over 7,000 rows) , don't want funky looping through each row, detecting widths, apply fixes.
thanks guys, allow me know if need more information.
edit -------------------------------------------------------------------------------------
our users utilize chrome 35.0.1916.153, , i've begun explicitly setting width of scrollbar create sure it's 16px:
::-webkit-scrollbar { width: 16px; border: 1px solid #ccc; }
again, works on monitor, @ moment cannot tell results on others. here's updated jsfiddle.
calc() can iffy cross-browser testing when need pixel perfect rendering. seek changing .grid-container .column-wrapper style this:
.grid-container .column-wrapper { width: 100%; padding-right: 16px; }
html css twitter-bootstrap
Comments
Post a Comment