Invalid CSS website load url

I am trying to use a background image in CSS, but even if I gave the full path to the image, it does not work. Firebug shows "Failed to load this URL." I am sure there is no permission problem in this folder. My CSS Class

body { background: url("H:/media/css/static/img/sprites/buttons-v3-10.png") repeat-x scroll left -800px #DCDCDC; color: black; font: 13px/1.2em arial,helvetica,clean,sans-serif; height: 100%; position: relative; } 

What could be causing the problem?

+7
source share
4 answers

You are using the local path. Is this really what you want? If so, you need to use the file:/// prefix:

 file:///H:/media/css/static/img/sprites/buttons-v3-10.png 

obviously this will only work on your local computer.

In addition, in many modern browsers this only works if the page itself is also in the local file path. Addressing local files from remote pages ( http:// , https:// ) has been widely disabled due to security concerns.

+23
source

I know this is really old, but I'm posting my solution anyway, as google finds this thread.

 background-image: url('./imagefolder/image.jpg'); 

That's what I'm doing. Two points mean drilling back one directory closer to the root "..", and one ".". should mean the beginning where you are, as if it were the root. I had similar problems, but I added that I fixed it for me. You can even leave "." in it when downloading to your host, because it should work fine, while the configuration of your directory is exactly the same.

+10
source

The source location should be a URL (relative to the css file or the full web location), and not the full path to the file system, for example:

 background: url("http://localhost/media/css/static/img/sprites/buttons-v3-10.png"); background: url("static/img/sprites/buttons-v3-10.png"); 

Alternatively, you can try using the protocol prefix file:/// .

+9
source

The source URL for the image may be a URL on a website, for example http://www.google.co.il/images/srpr/nav_logo73.png or https://https.openbsd.org/images/tshirt -26_front.gif or if you want to use a local file, try this: url ("file: /// MacintoshHDOriginal / Users / lowri / Desktop / acgnx / image s / images / acgn-site-background -X_07.jpg")

+1
source

All Articles