View Full Version : DIV height of 5px does not work in IE6

05-09-2007, 07:07 PM
I am using this code to get a div to sit with a 5px height:

.contentleftblueheader {
background: #0053A0;
width: 238px;
height: 5px;
margin: 0 0 10px 0;

No problems in IE7 or Firefox but good old IE6 does not like it. Does anybody have any ideas?

05-09-2007, 07:50 PM

05-09-2007, 10:06 PM
Hello BonRouge, you are suggesting this fix:

#thediv {
font-size: 0;
Just for your information, I have had problems with the font-size: 0 method when the div needs to go below 2px in height. Sometimes it works and sometimes it doesn't.

When trying to make a div small in height, it also seems to matter whether the div is empty or not. Even a single comment node can make difference.

One might also consider using overflow: hidden as an alternative which for some reason seems to be working also for divs smaller than 2px.

05-10-2007, 01:07 AM
the problem is this cool little thing that you need to put px behind a font-size: 0;

what {
font-size: 0px;

you might need to adjust line height as well but maybe not.

05-10-2007, 05:24 AM
koyama, harbingerOTV:
Yeah, those methods both work too. I should add those to my page. I didn't realize that there were problems with just setting the font-size to 0 though. I've never seen problems with that.

You don't need to put 'px' after '0' at all. '0' is '0' in any unit.