CSS CSS无效的属性值?

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

CSS Invalid Property Value?

css

提问by Manuel Medina

I don't understand what's wrong with this? I'm watching a tutorial and it seems to work fine on the video but both mozilla and chrome ignore this code and marks it as an invalid property value.

我不明白这有什么问题?我正在看一个教程,它似乎在视频上运行良好,但 mozilla 和 chrome 都忽略了此代码并将其标记为无效的属性值。

.btn {
    background-color: #4FB69F url("img/texture.png") no-repeat right top;
} 

回答by Dipesh Parmar

change

改变

background-color:

to

background:

Because backgroundis a shorthand property for

因为background是一个简写属性

  • background-color
  • background-image
  • background-position
  • background-repeat
  • background-attachment
  • 背景颜色
  • 背景图片
  • 背景位置
  • 背景重复
  • 背景附件

回答by user7340463

background-color: #4FB69F; 
background-image: url('images/texture.png'); 
background-repeat: no-repeat; 
background-position: right top;

Within the image url requires 'not "Background position is separate from no repeat and ;between each element control

图像url内要求''背景位置是分开的,没有重复和;在每个元素控件之间

回答by Illegal Argument

Not directly a solution but a typo in CSS property value caused similar issue for me:

不是直接的解决方案,而是 CSS 属性值中的错字给我造成了类似的问题:

.PokeCard {
border: 2px solic mediumseagreen;
}

The problem was a typo solicinstead of solid.

问题是错别字solic而不是solid

enter image description here

在此处输入图片说明