CSS背景图片网址无法加载 [英] CSS background image URL failing to load

查看:134
本文介绍了CSS背景图片网址无法加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在CSS中使用背景图片,但即使我给了图像的完整路径,它不工作。 Firebug显示无法加载指定的URL。
我确信那个文件夹没有权限问题。
我的CSS类是

I'm trying to use background image in CSS but even though I gave the full path of the image, it doesn't work. Firebug shows "Failed to load given URL". I'm sure that there is no permission problem in that folder. My CSS class is

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 issue?

推荐答案

您正在使用本地路径。这是真的你想要什么?如果是,您需要使用 file:/// 前缀:

You are using a local path. Is that really what you want? If it is, you need to use the file:/// prefix:

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

显然,这只会在您的本地计算机上工作。

obviously, this will work only on your local computer.

此外,在许多现代浏览器中,只有当页面本身本地文件路径。从远程( http:// https:// )寻址本地文件已由于安全原因。

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

这篇关于CSS背景图片网址无法加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆