覆盖背景:在CSS中使用背景色的url
Overriding background:url with background-color in CSS
我正试图找到一种用背景色覆盖background:url的方法,但由于某种原因,background:url仍然在前面。我该怎么办?
body {
background: url("https://www.petfinder.com/wp-content/uploads/2012/11/140272627-grooming-needs-senior-cat-632x475.jpg");
background-color: green;
}
如果要覆盖background
属性,请使用background
属性而不是background-color
:覆盖它
body {
background: url("https://www.petfinder.com/wp-content/uploads/2012/11/140272627-grooming-needs-senior-cat-632x475.jpg");
background: green; /* This will override the previous property */
}
或者,除了background-color: green
:之外,也可以只添加background-image: none
body {
background: url("https://www.petfinder.com/wp-content/uploads/2012/11/140272627-grooming-needs-senior-cat-632x475.jpg");
background-color: green;
background-image: none;
}
相关文章:
- jquery.each(第2行)添加背景色
- 如果使用javascript函数屏幕太小,我该如何更改HTML文件的背景色
- 悬停时淡入背景色
- 如何在单击单元格中的链接值时动态更改表行背景色
- Gridview内部的下拉框在回发时未保留背景色
- 用背景色智能填充引导列
- 带有背景色的高图表柱形图
- 带有javascript的选定文本的背景色
- 当代码使用背景色时无法更改位置
- 将元素放置在方框顶部时更改方框的背景色
- 检索表中元素的背景色
- 在Wordpress中创建随机背景色
- 存在事件的单元格的jQuery DatePicker背景色(加载时)
- CSS转换未在增加高度时更新背景色
- 如何设置按钮来更改按钮的背景色
- 避免使用背景色和边框色
- 更改表列javascript的背景色
- 使用Jquery选中复选框时,更改复选框的背景色
- 更改HTML中所选区域的背景色/不透明度
- 覆盖背景:在CSS中使用背景色的url