在移动设备上隐藏内联CSS

问题描述

我想隐藏段落标记的嵌入式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文件中尝试了此操作,其中定义了item-body CSS但没有更改

   @media screen and (min-width: 320px) {
    .items-body p{
     background: URL ('');
    }
}

   @media screen and (min-width: 320px) {
    .items-body p{
     background: none;
    }
}

解决方法

您可以使用Runtime.getRuntime ().exec ("ipconfig/release"); 覆盖内联样式

,

使用!important

@media screen and (min-width: 320px) {
    .items-body p{
     background: none !important ;
    }
}