How to Force a DIV Block to Fill the Page Vertically Even Without Content
In certain situations, you may encounter a scenario where you need a DIV block to extend to the bottom of the page regardless of its content. Here's how you can achieve this:
The Problem:
When a DIV block has no content, it typically collapses to occupy only the vertical space required for its borders and padding. As a result, it may not extend to the bottom of the page, leaving empty space.
The Solution:
To force the DIV block to fill the page vertically, address the following:
html, body { height: 100%; }
By following these steps, the DIV block will now extend to the bottom of the page, even if it has no content. However, note that browser compatibility andQuirks Modes may affect the final result, so consult resources like quirksmode.org for further adjustments.
The above is the detailed content of How to Make a DIV Fill the Entire Page Height Even When Empty?. For more information, please follow other related articles on the PHP Chinese website!