How to fix the table height?
Asked Answered
L

3

9

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

Lavenialaver answered 18/11, 2009 at 6:58 Comment(0)
T
15

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.

Twopenny answered 18/11, 2009 at 7:12 Comment(2)
This totally worked for me. thank you very much. :) At first I tried putting the style under #facebox .content but it didn't seem to work.Azygous
@paologranadalim: what facebox?Contingent
L
0
div.tablewrapper {
    height: 600px;
    overflow-y:hidden;
}

this works for to fix a page exact 600px as height..

Lavenialaver answered 18/11, 2009 at 8:9 Comment(0)
M
-6

See the sample code below..

<div style="height:100px; overflow:auto;">
<table>
    <tr>
        <td>sad<br />
<br />
<br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
asd<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />

</td>
</tr>
</table>
</div>
Mafalda answered 18/11, 2009 at 10:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.