CSS 背景图片 URL 加载失败 [英] CSS background image URL failing to load

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

问题描述

我正在尝试在 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 背景图片 URL 加载失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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