在移动设备上隐藏内联 CSS
Hide inline CSS on mobile device
我想隐藏要在移动设备上隐藏的段落标记的内嵌 css 背景图像。我该如何实现?
<div class="items-body">
<p
style={{ background: `url('${item.image.childImageSharp.fluid.src}') no-repeat right 30px` }}
><Content source={item.sectiontext} /> </p>
</div>
我在单独的 CSS 文件中尝试了此操作,其中定义了项目正文 CSS 但没有更改
@media screen and (min-width: 320px) {
.items-body p{
background: URL ('');
}
}
或
@media screen and (min-width: 320px) {
.items-body p{
background: none;
}
}
您可以用 !important
覆盖内联样式
使用 !important
@media screen and (min-width: 320px) {
.items-body p{
background: none !important ;
}
}
我想隐藏要在移动设备上隐藏的段落标记的内嵌 css 背景图像。我该如何实现?
<div class="items-body">
<p
style={{ background: `url('${item.image.childImageSharp.fluid.src}') no-repeat right 30px` }}
><Content source={item.sectiontext} /> </p>
</div>
我在单独的 CSS 文件中尝试了此操作,其中定义了项目正文 CSS 但没有更改
@media screen and (min-width: 320px) {
.items-body p{
background: URL ('');
}
}
或
@media screen and (min-width: 320px) {
.items-body p{
background: none;
}
}
您可以用 !important
使用 !important
@media screen and (min-width: 320px) {
.items-body p{
background: none !important ;
}
}