...

View Full Version : ie and small divs with background colors



Duffman12
02-26-2008, 06:31 PM
So i've come across a very strange bug with ie. i'm trying to simpley make a box with css and color the background. here's some sample code:


<style type="text/css" media="screen">
.poo{
height: 5px;
width: 20px;
line-height: 0;

background: blue;
border: 1px solid red;
}
</style>

<div class=poo> </div>
<br>
<div class=poo> asdfasdfasdf </div>

i just want the box with no content to be 5px high, and 20px wide.

the first div that doesn't have any content is the right width, but the height is more than 5px for some reason. I tried using line-height to fix that, but line-height only works when there is content in the div.

the 2nd div that has content in it is the right height, but not the right width. it stretches horizontally to accommodate the content. the line-height: 0 makes it so the div doesn't stretch vertically to fit the content.

also, if you size the div to anything above about 20px for the width and height, it seems to render fine. that's why i though the line-height might be the issue, but apparently it's not.

any ideas??

Apostropartheid
02-26-2008, 06:32 PM
Tried tying font-size down a notch too? =)

Duffman12
02-26-2008, 06:36 PM
amazing. that worked.

thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum