Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-26-2009, 01:51 AM   PM User | #1
JoelC
New Coder

 
Join Date: Jul 2009
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
JoelC is an unknown quantity at this point
Angry Placing Images in Divs

Hey guys, please take a look at this page:
http://www.joelfolio.com/image.html

As you can see, I've placed an image in a div.
For some reason this div is showing up with an extra couple of pixels on the bottom (under the image).
This only occurs in Firefox as far as I can tell. It works fine in Explorer.

I've tried setting margins and padding to 0px, removing bottom borders. Doing pretty much everything.

The code is simply:
Code:
<div style="background:#3F0"><img src="test.jpg"></div>
Any ideas how to resolve this?

Last edited by JoelC; 07-27-2009 at 08:20 PM.. Reason: added code
JoelC is offline   Reply With Quote
Old 07-26-2009, 08:25 AM   PM User | #2
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,812
Thanks: 9
Thanked 681 Times in 675 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
The gap underneath the img (in everything but IE) correctly allows space for the "tails" of g/j/y etc. You're using a strict doctype - which is fine - this means you need to add display:block to your css/styling for <img> to remove the gap.

Preferably, add:

Code:
img {display:block}
to your css , or, with your inline styling

Code:
<img src="test.jpg" style="display:block"/>
SB65 is offline   Reply With Quote
Users who have thanked SB65 for this post:
JoelC (07-26-2009)
Old 07-26-2009, 12:46 PM   PM User | #3
JoelC
New Coder

 
Join Date: Jul 2009
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
JoelC is an unknown quantity at this point
Thanks for the tip!
It worked

Last edited by JoelC; 07-26-2009 at 12:52 PM..
JoelC is offline   Reply With Quote
Reply

Bookmarks

Tags
div, extra, image, pixels

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:50 PM.


Advertisement
Log in to turn off these ads.