Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
295 views
in Technique[技术] by (71.8m points)

html - @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;. I need the burger menu to pop up when the screen is less than 992px wide but I have nothing. Where did I go wrong?

question from:https://stackoverflow.com/questions/65873689/media-max-width-992px-display-block-does-not-work

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...