You can't set a fixed or maximum height on any table elements. The height
property is only treated as a minimum height.
You can add display: block
to your tbody
. Since it's no longer one of the table-*
display types in that case, that will make it take the height. However, since the tbody
is no longer a table-row-group
, you'll essentially end up with an implicit table inside it again. So any columns in any other thead
, tbody
or tfoot
elements will no longer line up with that scrollable tbody
.
Apart from the column mismatching, though, this does make it almost work in all the latest browsers except IE. You should be able to fix the remaining issues yourself.
I have no idea how to fix it in IE, though. I did come across "Pure CSS Scrollable Table with Fixed Header", but that's rather out-dated, since both of his solutions work in IE6, but break horribly in IE7 and IE8 (in different ways too). They do work in IE's Quirks mode, though, so if you desperately need it, that might be your only option.