please explain this problem; I wanna ".nav__btn" class display’s be none where min-width: 768px; but it doesn’t work
——————–Media Code————————
@media (min-width: 768px) {
.nav__btn {
display: none;
}
}
————————-Styles Code———————–
.nav__btn {
width: 5.5rem;
height: 5.5rem;
display: flex;
align-items: center;
justify-content: center;
background-color: #fff;
border-radius: 2.2rem;
cursor: pointer;
}
I wanna ".nav__btn" class display’s be none
2
Answers
Place the script just before the closing tag to ensure that the JavaScript code is executed.
This way, it will listen for window resize events and adjust the ".nav__btn" element’s display property accordingly.
When rulesets have equal specificity, the later rule “wins” in the cascade.
The rule in the media query sets it to
display: none
when the width is over 768 px, then the rule after it sets it todisplay: flex
unconditionally.Change the order of your rulesets.