I'm trying to make a table scrollable with a fixed header with hover effect. I used this question to set my css file. I always got misaligned columns:
here is my Plnker demo:Plunker demo
any help please ?
I'm trying to make a table scrollable with a fixed header with hover effect. I used this question to set my css file. I always got misaligned columns:
here is my Plnker demo:Plunker demo
any help please ?
Your problem is that the display: block rule breaks table alignment.
Where you have:
.hoverTable tbody, .hoverTable thead { display: block; width: calc(100% - 17px); }
Remove that rule:
.hoverTable tbody, .hoverTable thead { width: calc(100% - 17px); }
You also have 9 th elements and 10 td elements. Place an empty th in at the end of the thead to equalize them.
display: block because I need the make the table scrollable, right ? I removed it and my table became not scrollableposition:sticky to make the heading cells to stay at its top, like this: plnkr.co/edit/NFcutk7xKgXTKoSps21o?p=previewdisplay: block does not enforce vertical alignment between columns like display: table (default) does. You will need to remove display block and work around the remaining layout quirks, or use a non-table responsive layout to insure correct display across all browsers. The sticky option also requires removing display: block to render correctly.