Forum Moderators: not2easy

Message Too Old, No Replies

Mystery bottom padding on divs with images

         

JAB Creations

6:36 pm on Aug 29, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've noticed that Firefox, IE, and Opera either add a bottom margin to an image or a bottom padding to a div when there is an image in a div.

Why is this behavior occurring and how can we stop it?

- John

bedlam

6:57 pm on Aug 29, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've noticed that Firefox, IE, and Opera either add a bottom margin to an image or a bottom padding to a div when there is an image in a div

This is almost certainly wrong. I'd guess that you're mistaking the fact that images are, by default, aligned with the baseline [en.wikipedia.org] (not the bottom!) of the inline box that they're contained by for padding or margins.

Set 'vertical-align [w3.org]' to 'bottom' or 'top' for images in the context where you find this problem or float the image in a floated container and the problem should disappear.

-b

JAB Creations

5:49 pm on Aug 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks!

- John

Robin_reala

6:32 pm on Aug 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or make the image display:block.