Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the navbar color in MaterializeCSS

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.

like image 252
SirMaxime Avatar asked Sep 02 '16 18:09

SirMaxime


People also ask

How do I change the color of materialized CSS?

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) !

How do I change the color of my navbar in HTML?

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 .

How do you change the color of a materialized icon?

$(". material-icons"). css("color", themeColor); This will change color of the material icons inside an element eg input field.

Which is better bootstrap or materialize?

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.


1 Answers

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!

like image 51
Igor Ivancha Avatar answered Sep 18 '22 22:09

Igor Ivancha