minimum height for a layout

Suppose I have two floated divs inside a container div to achieve a
simple 2-column layout:

<div id="contentcontainer">
<div id="content">content column</div>
<div id="navigation">nav</div>
</div>
<div id="footer">footer</div>

On some pages it may be possible for there to be very little content in
either column but on those pages, I don't want the layout to collapse to
a tiny height. I'd like there to be whitespace after the content so the
layout still has a reasonable height.

What is the best way to impose a minimum height?

I'm thinking you could do this:

#contentcontainer {
height: 200px; /* For IE lte 6 */
}
html>body #contentcontainer {
height: auto;
min-height: 200px;
}

200px being a more or less random value.

This seems to work OK, but is it a reliable method? Or should I put the
height on one of the floated divs, not the container?
Shion [ Mi, 28 November 2007 11:12 ] [ ID #1881232 ]

Re: minimum height for a layout

"Mark" <user [at] example.net> wrote in message
news:5r4t95F1304msU1 [at] mid.individual.net...

> On some pages it may be possible for there to be very little content in
> either column but on those pages, I don't want the layout to collapse to a
> tiny height. I'd like there to be whitespace after the content so the
> layout still has a reasonable height.

Why would you have pages with so little content that this tiny height
bothers you? URL?

--
Richard.
rf [ Mi, 28 November 2007 11:18 ] [ ID #1881234 ]

Re: minimum height for a layout

Post removed (X-No-Archive: yes)
Notifier Deamon [ Mi, 28 November 2007 14:44 ] [ ID #1881248 ]

Re: minimum height for a layout

On 28 Nov, 10:12, Mark <u... [at] example.net> wrote:

> This seems to work OK, but is it a reliable method?

You can either force a minimum height on the container, or you can add
an element with "clear" after the floated elements. Depends whether
you want to always force a minimum height (which might be a big empty
space), or just to force a minium height that's reliably bigger than
the float (to stop the floated elements hanging out of it).

> Or should I put the
> height on one of the floated divs, not the container?

No, because setting thhe height of a floated box definitely _won't_
set the height of its container. Read http://brainjar.com/css/positioning/
Andy Dingley [ Mi, 28 November 2007 15:05 ] [ ID #1881249 ]
Miscellaneous » alt.html » minimum height for a layout

Vorheriges Thema: Is Dreamweaver hogging up CPU usage?
Nächstes Thema: Problem in page display