Why no background image?
January 20, 2009 1:52 AM   Subscribe

Stupid easy question about background-image css.

OK, so my html page is linked to a css file.

In the css, the body is styled thus:
body {
        background-image: url(/img/stripes.gif);
	background-repeat: repeat-x;
	font-family: Helvetica, Verdana, Arial, sans-serif;
	border: 0;
	padding: 0;
	margin: 0;		
	background: #BFCDAC;
}
and the image is sitting in the proper /img folder.

So, why does the page look like this, without the background image? I must be doing something stupid and obvious, but I can't see it...
posted by Meatbomb to Computers & Internet (5 answers total) 2 users marked this as a favorite
 
using a root slash to your images folder isn't working here... it's trying to find

http://www.themoderninstitute.eu/img/stripes.gif

whereas in actual fact the url of the image is

http://www.themoderninstitute.eu/demo/img/stripes.gif

Your css should be

background-image: url(img/stripes.gif);
posted by derbs at 1:58 AM on January 20, 2009


Check that image URL - I get a 404 when I hit http://www.themoderninstitute.eu/img/stripes.gif
posted by syzygy at 1:58 AM on January 20, 2009


Response by poster: OK, WTF???

Just to avoid another potential source of confusion, I have dumped this demo file into my root directory...

So, now I have the html file and the css right in root, and the image in the root /img folder as well...

http://www.themoderninstitute.eu/clearo.htm
http://www.themoderninstitute.eu/img/stripes.gif
http://www.themoderninstitute.eu/sofia.css

And still no satisfaction... I feel like I am in the css special olympics here...
posted by Meatbomb at 2:36 AM on January 20, 2009


Best answer: You have: background: #BFCDAC;

The background selector specifies ALL background attributes, including background image. So it overrides the previous, more specific, background-image selector.

Just change it to background-color: #BFCDAC;
posted by le morte de bea arthur at 2:47 AM on January 20, 2009 [3 favorites]


Response by poster: DING DING DING

My hero is "le morte de bea arthur".
posted by Meatbomb at 2:53 AM on January 20, 2009


« Older No points = No insurance increase?   |   I screwed up my calf muscles. Newer »
This thread is closed to new comments.