Forum Moderators: not2easy
100px high header
variable height content area with scrollbar if overflow
100px high footer
I was able to achieve this design with the following CSS, but it doesn't work in IE.
div#content {
height: auto;
position: absolute;
bottom: 100px;
top: 100px;
overflow: auto;
} Is it possible to achieve this kind of layout in a way that would be cross-browser compatible? Or is there maybe a different approach that I could take?
I'll research CSS frames... what I want to do is exactly like using frames and setting the middle content height to * so that it just fills in the vertical space that's left between the header and footer and does so dynamically as the browser window is resized.
Man .. I was beginning to think I wouldn't find a solution.
Apparently, the key is to use fixed positioning. Because IE doesn't currently support fixed positioning, you have to hack it by using the IE faulty box model. In order to get valid code and still use the faulty box model, you have to begin your document with something other than a DOCTYPE declaration, like so:
<?xml version="1.0" encoding="UTF-8"?> The container divs for your header and footer are then styled using absolute positioning, and the div that you want to scroll gets a fixed position attribute with the * html hack for IE to use the faulty box model instead of fixed positioning. Check out that webreference.com tutorial.
Things shouldn't have to be this difficult. And thank you, Stu Nicholls, for writing that tutorial.
Another more complicated, but far more flexible solution that relies on JavaScript, can be found by googling "Frames without frames Introduction". It's pretty incredible.