Need help with background image

I’m trying to learn web code using the Build Your Own Website book and have had no problems until I tried atatching background images to the sample website using the background: color url(backgrounds .jpg) link. I can do it with regular images…why can’t I do it with background images? I’m thinking it may have to do with my browser, but i’m not sure and don’t know how to fix that if that is the case.


Hi obrien45. Welcome to the forums. :slight_smile:

I’ve moved your post to its own thread. Could you post the full background image code you are using? I assume that [COLOR="#FF8C00"]background: color url(backgrounds .jpg)[/COLOR] is not the actual code you are using. But just for the record, you shouldn’t have a space between the file name and the file extension. E.g. it should be [COLOR="#FF8C00"]backgrounds.jpg[/COLOR], not [COLOR="#FF8C00"]backgrounds .jpg[/COLOR].

I don’t think it has anything to do with the browser.

I recall that the Build Your Own Website book organized files into images, css, and javascript folders. If you have a css file linking to an image, the image has to be in the same folder…remember that. Also, check again your file name. If you’re using a jpeg file, I find sometimes that it doesn’t work because the file has a 4-character ‘jpeg’ extension rather than a 3-character ‘jpg’ extension. On Windows, right-click and select properties. Then, look for a file extension in parentheses.


The full background mage code that i’m using is background: #7da5db url(backgrounds/nav-bg.jpg) no-repeat;

I know it’s probably I relitively simple image code, but for some reason my browser doesn’t seem to make the required connection, ad i can’t figure out why.

I’m really new to this stuff.

It may be that you are not pointing the browser to the right location. Where is the image stored in relation to your style sheet? That is, what folder is the style sheet in, and what folder is the image in? At the moment, your style sheet is in a certain folder, and the link you’ve given it is to a folder called “backgrounds” within that folder. Is that where you “backgrounds” folder is?

If at the root directory, you have a folder “backgrounds” you can easily modify your CSS above to…

[COLOR=#464646]background: #7da5db url(/backgrounds/nav-bg.jpg) no-repeat;

If your backgrounds file IS INDEED within the stylesheet folder, this is a prediciment. If all else fails you can try the absolute URL and see if it even loads then. If you load up firebug, and find the element and check the styles, you can see exactly where the image is trying to be called from.[/COLOR]