CubeJockey CubeJockey - 4 months ago 22x
HTML Question

How can I keep the bottom contents of a webpage static when under a dynamic table?

I am working on some custom pagination which often leads to a "last page" having less than the max number of rows. I would like to keep the webpage mostly static when the table drops some or most of its rows. i.e. scrollbar should keep to the same length.

To rebuild the contents of my pagination table, I am using an Ajax call in Struts 1.x to pull a

, whose information is used to build raw HTML data to replace the existing:

$('#resultsDisplay tbody').remove();

I've played around with some rows which can be built in place of missing data, but even when hidden those doesn't seem to work as expected.


A simple way to do this is to wrap the table in a container div and give that a min-height. You can't do this directly to the table because that causes it to stretch, which you probably don't want. Here's an example:

div {
  min-height: 20em;
  background: #ddd;