For a while, I've been putting * html div { zoom: 1; }
in my base stylesheet, and it has worked great. However, I now run into situations where there're elements that are absolute positioned that are losing their heights and widths in IE 6 cuz of this. So I'm thinking of putting * html div { height: 1%; }
instead, but what are the side effects?
Update:
Thanks for all your responses. The answer is most probably no side effects as all of you said.
I will however have to disagree with all your recommendations (at this given moment) about how/when to trigger haslayout. I see haslayout a desirable behaviour and should therefore be a default behaviour in IE6 (& 7).
It's been mentioned that it's unlikely there would be any side effects, for the exact reason, why not make it a default behaviour and only turn it off when an undesirable behaviour (if ever) occurs.
One can do this by specifying {zoom: auto;}
or {height:auto;}
on that specific element depending on how it was defined in the base stylesheet.
I will have to give the answer to the first person that said "no side effects" since everyone's answer is the same, while some went out of scope. Thanks again!
Using inline-block property: Use display: inline-block property to set a div size according to its content.
The reason why the height or the containers is 0 is because you are floating all the content inside them and floated elements don't expand the height (or width) of their parents.
This is known as The Holly Hack. As far as I know, there isn't a side effect, especially if you * html
it for IE6 directly. I agree with the other posters that placing it on the <div>
tag may not be the wisest choice - I'd target the individual elements that are causing grief.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With