tags:

views:

151

answers:

4

Hello, how can i set minimal height for div? But it have to resize with new data.

A: 
div#foo {
min-height:10em;
}

in ie6.css or prepend with * html selector ( hack warning )

div#foo { height:10em; }

Since MSIE6 doesn't support min-height.

meder
Or you could use conditional comments instead of a css hack.
voyager
That's what I meant by "ie6.css" ...
meder
Note that my second example was catered to IE6 only, it didn't contain star html. I just threw that in there for completion.
meder
A: 

You want the CSS property min-height. You'll need to be careful of not great browser support (particularly older versions of IE, shockingly enough).

Dominic Rodger
+1  A: 

min-height works fine... except in IE.

The way to fix it and therefore use it everywhere is importing ie7.js

marcgg
Yeah, and when JS is disabled? Plus the extra overhead... even if it solves other things I don't think it's worth it. But props to Dean E. for the idea.
meder
This is still better than having it breaking all the time. People with JS disabled are used to see broken websites anyways :)
marcgg
+1  A: 
div#name
{
    height: 60px;
    height: auto !important;
    min-height: 60px;
}

This should work across browsers including IE