Html 无效的属性值?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11421008/
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-08-29 01:34:01  来源:igfitidea点击:

Invalid property value?

htmlcss

提问by Spike

I'm trying to give my search bar a background, using css. But chrome keeps giving the error "invalid property value". Which is weird because my navigation bar is the exact same code but doesn't give the error? http://ispiked.net/tests/

我正在尝试使用 css 为我的搜索栏提供背景。但是 chrome 不断给出错误“无效的属性值”。这很奇怪,因为我的导航栏是完全相同的代码,但没有给出错误? http://ispiked.net/tests/

回答by Tom Walters

This is because you've also specified "no-repeat" along with your background image. Alter your code to:

这是因为您还指定了“不重复”和背景图片。将您的代码更改为:

background: url(images/searchbar.png) no-repeat;

回答by dgl

Another way to do that is to use background-repeat property.

另一种方法是使用 background-repeat 属性。

background-image: url('images/searchbar.png');
background-repeat: no-repeat;