On Having Layout

On Having Layout

I spent several hours today sorting out an IE7 CSS bug that was solved by the concepts described in this article -- On Having Layout.

I'm adding this here as a bookmark but also as a heads up for other programmers dealing with CSS related IE6/7 bugs.

"A lot of Internet Explorer's rendering inconsistencies can be fixed by giving an element “layout.”" Who knew you had to give IE layout??

----------------------

To give layout to IE6 and lower use the underscore hack:
.gainlayout { _height: 0; }

or use the IE6 conditional
<!--[if lte IE 6]><style>.gainlayout { height: 1px; }</style><![endif]-->

----------------------

To give layout to IE7 use the min-height property:
.gainlayout { min-height: 0; }

or use the IE7 conditional
<!--[if IE 7]><style>.gainlayout { zoom: 1; }</style><![endif]-->

----------------------

Filed Under: Bookmarks, Coding