简体   繁体   English

@media(最大宽度:992px)。 显示:块不起作用

[英]@media (max-width: 992px). display: block does not work

@media (max-width: 992px) {
    .menu__list {
        display: none;
    }
    .btn__menu {
        display: block;
    }
}

.btn__menu div {
    height: 5px;
    background-color: #000;
    margin-bottom: 5px;
}

.btn__menu {
    width: 40px;
    display: none;
}

The code above writes me that I have an error in display: block;上面的代码告诉我我在display: block;中有一个错误。 . . I need the burger menu to pop up when the screen is less than 992px wide but I have nothing.当屏幕宽度小于 992 像素时,我需要弹出汉堡菜单,但我什么都没有。 Where did I go wrong?我在哪里 go 错了?

Swap the order - your general rules will overwrite the media query rules the way it's now, since they follow * after* them.交换顺序 - 您的一般规则将按照现在的方式覆盖媒体查询规则,因为它们*在*它们之后*。 So just move the media queries to the end.所以只需将媒体查询移到最后。

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

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