为什么@media only屏幕CSS无法与!IMPORTANT;?

问题描述 投票:0回答:1

唯一可以让css @media工作的时间是,如果我使用!重要;在CSS像

@media only screen and (max-width: 600px)
.example {
    padding-left: 2px !IMPORTANT;
}

.example {
    width: 118px;
    position: absolute;
    padding-left: 21px;
    padding-top: 11px;
}


如果我在@meda css中不使用!IMPORTANT,样式将不会显示,所以问题是,为什么?我不想使用!IMPORTANT;但是css @media无法使用它。请帮助

css styles media
1个回答
1
投票

对我来说很好。也许对于覆盖它的类也有另一个CSS。

.example {
    width: 118px;
    position: absolute;
    padding-left: 21px;
    padding-top: 11px;
    background: red;
}

@media only screen and (max-width: 600px) {
  .example {
      padding-left: 2px;
      background: blue;
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.