Making responsive website,
I wrote this, it doesn't work.
@media (max-width: 767px) {
#nav { display:block; }
}
but, I wrote this, it works!
@media (max-width: 767px) {
#nav { display:block !important; }
}
Why? :(
Making responsive website,
I wrote this, it doesn't work.
@media (max-width: 767px) {
#nav { display:block; }
}
but, I wrote this, it works!
@media (max-width: 767px) {
#nav { display:block !important; }
}
Why? :(
Check your css code , something with higher specificity is changing your #nav element.
This is a little concept:
!important
after the style attribute gives high priority to that style. That is why your css is working then.
!important
override the existing stylesheet attribute defined in same context.
!important
will override any inline style, or more specific style that may be taking precedence on your page.
For example, you can override the style on this element...
<div style='background-color:white'></div>
by adding this in your stylesheet...
div { background-color: black !important }
But!, if you add !important
to the inline style, it will then take precedence, for example...
<div style='background-color:white !important'></div>
here is a good stackoverflow answer explaining the concept in a bit more detail.