简体   繁体   English

媒体查询与显示选项一起使用

[英]media query works with display option

I have attached this media query with my css class. 我已经在CSS类中附加了此媒体查询。

CSS CSS

  @media all and (max-width: 600px) {
    .details{
       display:block;
    }
}

.details{

  margin-left: 20px;
   font-size: 15px; 
    color: black;
}

HTML HTML

 <p class="details" > My career has taken a natural progression fro m client websites, to UI templates, to simple php websites, to Laravel framework. </p>

My problem is that in the media query class, whatever I write instead of display nothing works. 我的问题是在媒体查询类中,无论我写什么而不是display什么都行不通。 I am trying to give a different color color:blue and but the color remains same. 我正在尝试使用不同的颜色color:blue和,但是颜色保持不变。

what is the issue? 有什么问题?

Just change the order: 只需更改顺序:

.details{

  margin-left: 20px;
   font-size: 15px; 
    color: black;
} 
@media all and (max-width: 600px) {
    .details{
       display:block;
      color: blue;
    }
}

move media query to bottom of details class. 将媒体查询移至详细信息类的底部。

when you set a property for a class or id more than once, the last one affects the class or id. 当您多次为类或ID设置属性时,最后一个会影响该类或ID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM