background image in a div...

Elderly Newt

Senior member
May 23, 2005
430
0
0
I want to have a div box have a background image. I'm trying to use background-image.... but no image shows up. Nothing. Not even a red X. This is how it looks:

#header {
background-image: url(header.jpg);
}

The image is in the same directory as the page itself. Why isn't this showing up? Just for kicks, I tried linking it to Google's logo using the full URL... and it worked :confused:
 

txrandom

Diamond Member
Aug 15, 2004
3,773
0
71
Try

#header {
background: url(header.jpg) #000;
}


Try some other things:
1. Make sure your CSS is actually working, I usually just add "border: 1px solid #000;"
2. Make sure everything is case sensitive.
3. Download Firebug (a very handy tool for Firefox) and see if you can find anything wrong.
4. Try a different picture?
 

Elderly Newt

Senior member
May 23, 2005
430
0
0
thanks for your help, i found the problem though... i was specifying the image location relative to the html file and not the css file... doh!
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Yeah, image problems like missing files are tricky in CSS, because the browser doesn't give you any indication what the problem is. Glad you found it.