Forum Moderators: not2easy

Message Too Old, No Replies

height of <div> & <img> = 50px, but IE has a GAP!

         

lenmcgrane

11:21 pm on Dec 8, 2004 (gmt 0)

10+ Year Member



Hi,

I have a banner 800x50 to run across the top of my page. I have a <div id="top"> that has height:50 and margin:0 and padding:0

But there is a GAP of about 2px along the bottom of the image inside that <div>

Is this something I have to live with? Or is there a fix?

Thanks in advance,
Len

Harvs

11:36 pm on Dec 8, 2004 (gmt 0)

10+ Year Member



Hey lenmcgrane,

Do you have a border around this banner?

What browser are you using?

If possible can you post the css code and the html code used to display your banner.

DrDoc

12:02 am on Dec 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld! [WebmasterWorld.com]

The reason why you get the gap is because images, by default, rest on the baseline of adjacent text. Consider the following example:

test:)again:)blah:)pjgqy

See how the images are lined up with the text baseline? In your case, the baseline is still there, regardless of whether there is any text present or not. So, the "gap" you see is nothing more than the space reserved for the descenders on letters like p j g q y. To avoid this, simply alter the vertical alignment for your image:

vertical-align: bottom;

lenmcgrane

12:13 am on Dec 9, 2004 (gmt 0)

10+ Year Member



Wow! That worked Dr Doc. Thanks a million.

Thanks also Harvs.

Len