简体   繁体   English

媒体查询下限不起作用

[英]media query min bound isn't working

I have this query in my css. 我的CSS中有此查询。 Originally the width is 100% and when the screen size is between 768 and 1024 px I want it to be 50% . 最初, width100%并且当屏幕大小在7681024 px之间时,我希望它为50% The max-width seems to be working because the width gets halved but once the screen width goes below 768 it still stays 50%. max-width似乎起作用了,因为width减半了,但是一旦屏幕宽度低于768它仍然保持50%。 Should it not revert back to 100% ? 是否不应该恢复到100%

@media (max-width: 1023px) and (min-width: 768px)
  .item {
    width: 50%;
}

You are missing a couple curley brackets. 您缺少几个居里括号。 It should look like... 它看起来应该像...

@media (max-width: 1023px) and (min-width: 768px) {
    .item {
        width: 50%;
    }
}

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

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