Gap between image and border

Show off new creations, get help, or just chat about all aspects of web development and design.

Gap between image and border

Postby abathor on Wed Mar 18, 2009 4:34 pm

I have an image which I have placed a border around with css like so:

div#mainBackground
{
border:1px solid #000000;
}

But as you can see from the image, there is a small gap between the bottom of the image and the border around it. I can't work out why. Any suggestions?

Image
User avatar
abathor
1337 p0st3r
1337 p0st3r
 
Joined: Mon Dec 18, 2006 6:02 pm
Location: England

Re: Strange lines in page background

Postby zombie@computer on Wed Mar 18, 2009 6:01 pm

if its a solid color, why not use the color: styles ?

Since you are using a JPG with one color, did you make it 1px*1px ? any larger may change colors slightly due to compression, leaving effects like the one you are describing

Not sure if thats the cause of your problem, but its work a shot.
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: Gap between image and border

Postby dissonance on Wed Mar 18, 2009 9:06 pm

i'd suggest border:'ing the <img>, not the <div>.
also try img#whatever { padding: 0px; } or { margin: 0px; }. I forget which one is correct.
i had fun once, and it was awful.
User avatar
dissonance
Veteran
Veteran
 
Joined: Wed Oct 10, 2007 12:35 am
Location: usa

Re: Gap between image and border

Postby dissonance on Wed Mar 18, 2009 9:07 pm

oh, and make sure you're terminating the <img> if this is xhtml like so: <img src="foo/bar.jpg" /> and delete any <br/>s in the area.
i had fun once, and it was awful.
User avatar
dissonance
Veteran
Veteran
 
Joined: Wed Oct 10, 2007 12:35 am
Location: usa

Re: Gap between image and border

Postby zombie@computer on Wed Mar 18, 2009 9:23 pm

hey, you edited your question, now my reply looks out of place. Poop :(
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: Gap between image and border

Postby abathor on Thu Mar 19, 2009 3:55 pm

zombie@computer wrote:hey, you edited your question, now my reply looks out of place. Poop :(


:lol:

Sorry, problem now solved anyway!
User avatar
abathor
1337 p0st3r
1337 p0st3r
 
Joined: Mon Dec 18, 2006 6:02 pm
Location: England

Return to Web Design & Development

Who is online

Users browsing this forum: No registered users

cron