...

View Full Version : Background Image not working Css



Yaz1994
11-09-2012, 03:04 AM
Hi, This is my first post here! I am stuck with some CSS, I am trying to link an image to my stylesheet but it does not work unless it is in the style sheet folder bearing in mind that the image is in a diffrent folder. My folder structure is:
- As > Css > style.css
- As > images > banner.jpg

when I do <img src="..\images\banner.jpg"> the image works perfectly fine, when I put that into my css nothing comes up:
background-image:url('..\images\banner.jpg');

tried a lot of diffrent things such as:
background-image:url('\images\banner.jpg');
background-image:url('..\images\banner.jpg');
background-image:url('..\..\images\banner.jpg');

I'd be very grateful if someone is willing to help me fix my issue!
Thanks!!!

DanInMa
11-09-2012, 03:59 AM
looks fine, you probably need to show more or it's an environment issue, like it's not on your webserver or you are viewing it locally or it missing or something, there are other possibilities but your syntax appears fine.
what element are you applying this background image to?
does it have enough height and width to display the image?

minder
11-09-2012, 04:23 AM
The relative path to your image in your css needs to be relative to the folder the css file is in, which you have and so that is not your problem.

There are many possibilities as to why your image is not appearing.

How are you linking your external stylesheet to your html file?

Have you some embedded css in your html file stopping the bg image from appearing?

etc

etc

etc

Post your actual code so people can see what is going on.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum