Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



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

Posts: 1
Trades: 0
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 06:56 PM..
tslice is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-19-2008, 08:16 PM Re: unwanted padding at bottom of img in div
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
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, 09:36 PM Re: unwanted padding at bottom of img in div
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
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 !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to unwanted padding at bottom of img in div
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
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.41637 seconds with 12 queries