So I'm using bootstrap to make a navbar and used their example navbar as my foundation. I fiddled with the bootstrap file to make it so that the navbar will collapse at 995px instead of 768px. Now because of that my navbar's button stays at the left side until the window size is below 768px. I found that if I changed
@media (min-width: 768px) {
.navbar-header {
float: left;
}
}
to
@media (min-width: 995px) {
.navbar-header {
float: left;
}
}
then it works fine.
However I put
@media (min-width: 995px) {
.navbar-header {
float: left;
}
}
into a custom.css and loaded it after bootstrap.css and no change occurred. My custom.css didn't override the boostrap.css. I would like to refrain from changing the bootstrap.css.
So the quick fix is adding !important
to your custom styles.
Another way to fix this is to make your custom styles more specific. I'm talking about the selector. You should give the element an Id and call that in your custom styles.
This makes your custom styles more specific, and therefore take precedence. You can also increase the specificity by indicating the parents in the selector.
header #yourNewId { ... }
> #yourNewId{ ... }
> .navbar-header{ ... }
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments