KARPACH

WEB DEVELOPER BLOG

How to set div height in IE6 a to small value such as 5px?

IE6 doesn’t render correctly the height of a small value. It just doesn’t shrink to a such small value. The answer is to use overflow : hidden. The overflow┬áproperty sets what happens if the content of an element overflow its area.

Possible values:

visible - Default. The content is not clipped. It renders outside the element

hidden - The content is clipped, but the browser does not display a scroll bar to see the rest of the content

scroll - The content is clipped, but the browser displays a scroll bar to see the rest of the content

auto - If the content is clipped, the browser should display a scroll bar to see the rest of the content

Javascript syntax:

object.style.overflow="hidden";

It seems that IE6 has some kind of default value for div, which doesn’t fit in the height of 5px.

Posted on May 25, 2008 by

Comments

Posted on 11/18/2008 12:55:41 AM by Esben

You could add the font-size:1px to your css, targeting the div with the 5px height. Then IE6 will render the height as IE7, FF does.
I didn’t know that. Thank you for a tip.

Posted on 7/25/2010 10:29:07 PM by sonu

thnks a lot…

it realy solve my problem….