Click to See Complete Forum and Search --> : [RESOLVED] Height issue with IE


scottpoliseno
06-06-2007, 03:03 PM
Ok...

Whenever I have a div element IE wants it to have a height equal to the text. I added a 1 pixel gif to try to stop it but that didn't work. Is there a cause or workaround for this?

Thanks,

Scott

sheephat
06-06-2007, 03:05 PM
I don't undertand what you are tring to do.

scottpoliseno
06-06-2007, 03:10 PM
Sorry about that...

Here is an example:


<div id="id_name_here"></div>


css:

#id_name_here
{
height: 5px;
background-color: #ffae00;
}



When this displays on IE the height is set to the minimum text size and not 5px. Do I have to specify fonts only for specific DIV tags instead of having all DIV tags set to 14px font height?

Thanks...

scottpoliseno
06-06-2007, 03:18 PM
I found the problem... If the div tag is formatted like this the error occured


<div id="id_name_here">
<img src="images/spacer.gif">
</div>


If I put the <img> tag on the same line with the opening div tag the error disapperared....

Is there a reason for this or just an IE bug?

Scott

Weedpacket
06-06-2007, 06:31 PM
IE is rendering the line break between the <div> and <img> tags as a space (ditto the line break between the <img> and the </div>). This is a violation of the HTML (http://www.w3.org/TR/html401/appendix/notes.html#notes-line-breaks) specification, and also breaches the rules of conduct for XHTML. So yes, it's an IE bug.

NogDog
06-06-2007, 08:58 PM
Another work-around is to specify that image element's style as "display: block;".