更改 CSS 中 class 的背景颜色不起作用?
Changing the background colour of a class in CSS not working?
我正在尝试更改 h1 class 的 background-color,但我尝试进行的任何更改都没有效果,这是我编写的代码:
.entry-title {
background-color: #f0eaca;
}
标题显示为白色而不是其他所有内容的米色:https://apatheticpaper.wordpress.com/2015/02/13/raf-simons/
如有任何帮助,我们将不胜感激。
您的标题 class 似乎被某些媒体查询覆盖:
@media only screen and (min-width: 1359px)
.single .featured-portrait .entry-title {
color: white;
}
}
您要么需要用特殊性或 !important(不建议)覆盖它:
.single .featured-portrait .entry-title {
color: #f0eaca;
}
这 class 超过了你的 属性
.page .featured-portrait .entry-title
{background-color:white;}
改为
.page .featured-portrait .entry-title
{background-color:#f0eaca;}
尝试使用 !important
作为另一个选项
不要使用 !important。
问题是,它有一个背景样式。所以,
.single .featured-portrait .entry-title, .page .featured-portrait .entry-title
{
background : none repeat scroll 0 0 #f0eaca;
}
会做。
正如我目前在您的代码中看到的那样:
h1.entry-title {
background-color: #f0eaca !important;
}
所以要更新您的代码,您需要将相同或更高的优先级设置为:
h1.entry-title {
background-color: #123456 !important;
}
我正在尝试更改 h1 class 的 background-color,但我尝试进行的任何更改都没有效果,这是我编写的代码:
.entry-title {
background-color: #f0eaca;
}
标题显示为白色而不是其他所有内容的米色:https://apatheticpaper.wordpress.com/2015/02/13/raf-simons/
如有任何帮助,我们将不胜感激。
您的标题 class 似乎被某些媒体查询覆盖:
@media only screen and (min-width: 1359px)
.single .featured-portrait .entry-title {
color: white;
}
}
您要么需要用特殊性或 !important(不建议)覆盖它:
.single .featured-portrait .entry-title {
color: #f0eaca;
}
这 class 超过了你的 属性
.page .featured-portrait .entry-title
{background-color:white;}
改为
.page .featured-portrait .entry-title
{background-color:#f0eaca;}
尝试使用 !important
作为另一个选项
不要使用 !important。
问题是,它有一个背景样式。所以,
.single .featured-portrait .entry-title, .page .featured-portrait .entry-title
{
background : none repeat scroll 0 0 #f0eaca;
}
会做。
正如我目前在您的代码中看到的那样:
h1.entry-title {
background-color: #f0eaca !important;
}
所以要更新您的代码,您需要将相同或更高的优先级设置为:
h1.entry-title {
background-color: #123456 !important;
}