How to fix the table height?

Jacob_pgr picture Jacob_pgr · Nov 18, 2009 · Viewed 20.2k times · Source

I want to fix the table height to 600px, eve if the content goes long.

Answer

Amber picture Amber · Nov 18, 2009

Try wrapping the table within a div tag, and setting the CSS properties of the div like so:

div.tablewrapper {
    height: 600px;
    overflow-y: auto;
}

This will make a scrollbar appear if the table's height exceeds 600 pixels. If you don't want to always force the height to 600px if the table it too small to take up that much space, but instead just want 600px to be the max, use max-height instead of height.