Reply
unwanted padding at bottom of img in div
Old 02-19-2008, 05:55 PM unwanted padding at bottom of img in div
Junior Talker

Posts: 1
I'm not sure how to get rid of some unwanted padding at the bottom of an img that is inside a div that has a border.

I'm on a mac and the padding appears in both safari and firefox, so I'm assuming its not a browser bug.

html:
<div id="credit_output">
<div>
<div id="img">
<img src="image.jpg" alt="image"/>
</div>
<div id="info">2<br/>
2<br/>
</div>
</div>
<div id="links">
<a href="edit.html">edit</a>
<a href="remove.html">remove</a>
</div>
</div>

css:
#credit_output {
padding: 5px;
border-top-width: thin;
border-right-width: thin;
border-bottom-width: thin;
border-left-width: thin;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #CCCCCC;
border-right-color: #999999;
border-bottom-color: #999999;
border-left-color: #CCCCCC;
position: relative;
}
#credit_output #img {
border: thin solid #000000;
float: left;
}
#credit_output #info {
float: left;
padding-left: 5px;
}
#credit_output #links {
clear: both;
background-color: #CCCCCC;
padding: 2px;
}
#credit_output #links a {
padding-right: 15px;
padding-left: 5px;
background-color: #CCCCCC;
}

Last edited by tslice : 02-19-2008 at 05:56 PM.
tslice is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 02-19-2008, 07:16 PM Re: unwanted padding at bottom of img in div
Gilligan's Avatar
Dead Like Me

Posts: 1,569
Name: Stefan
Location: London, UK
Try adding this to the CSS.

Code:
 #credit_output  #img img {
padding:0;
margin:0;
}
Gilligan is offline
Reply With Quote
View Public Profile
 
Old 02-19-2008, 08:36 PM Re: unwanted padding at bottom of img in div
LadynRed's Avatar
Super Moderator

Posts: 5,973
Location: Tennessee
And, put the proper width and height dimensions on the image in your HTML.

It's also not a good practice to use IDs like 'img' when the tag is 'img'.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to unwanted padding at bottom of img in div
 

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12175 seconds with 13 queries