I want to dynamically change the background color of the navbar from Materialize, so it needs to be done via a CSS. I tried doing
.nav-wrapper{
background-color: <MYCOLOR HERE> !important;
}
But it just stays the same colored as mentioned in the class of the navbar.
Materialize comes with a color palette based on the material design base colors. I recommend you to use these to set theme colors, to follow the Material Design color system. Show activity on this post. $primary-color: lighten(blue, 2) !
Use any of the . bg-color classes to add a background color to the navbar. Tip: Add a white text color to all links in the navbar with the . navbar-dark class, or use the .
$(". material-icons"). css("color", themeColor); This will change color of the material icons inside an element eg input field.
The main difference between the two frameworks is that Bootstrap grants you significantly more freedom and control while Materialize is more opinionated about how your elements should look and behave.
Because in Materialize you have to change nav
's background-color, for example you want white navbar:
.nav {
background-color: #ffffff !important;
}
Another solution, to add <nav>
's class white
:
<nav class="white">
It'll change navbar's backgroud-color too.
If you're using sass or scss, you have one more solution:
nav {
@extend .white;
}
Hope, it helps you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With