CSS 背景图像:url(none) 导致 apache 日志文件中的错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1161061/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 17:56:01  来源:igfitidea点击:

CSS background-image: url(none) leading to errors in apache log file

htmlcssapache

提问by jeroen

I have run into a strange problem. When I use:

我遇到了一个奇怪的问题。当我使用:

background-image: url(none);

in my css file, it generates an error in the apache log file:

在我的 css 文件中,它在 apache 日志文件中生成一个错误:

File does not exist: /...../styles/none, referer: http://blabla.com/styles/styles.css

I have used the W3C CSS validator and there are no errors (just some warnings about floats needing widths).

我使用了 W3C CSS 验证器并且没有错误(只是一些关于需要宽度的浮点数的警告)。

I used to have:

我曾经有过:

background-image: none;

but I have changed all instances and the most up-to-date stylesheet is used.

但是我已经更改了所有实例并使用了最新的样式表。

Is this normal behaviour or is it more likely that I have an error somewhere in my stylesheet?

这是正常行为还是更有可能我的样式表中的某个地方有错误?

回答by zombat

This is normal. By using the url()syntax, anything you put into the brackets is considered to be a URL. The browsers are making an http request for a resource called none.

这是正常的。通过使用该url()语法,您放入括号中的任何内容都被视为 URL。浏览器正在向名为 的资源发出 http 请求none

Basically, you've specified an invalid url for a background image.

基本上,您为背景图像指定了一个无效的 url。