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:
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...
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...
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
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
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]
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
My hero is "le morte de bea arthur".
posted by Meatbomb at 2:53 AM on January 20, 2009
This thread is closed to new comments.
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