Changing the text color on a nav bar using Materialize CSS (rails)

torie picture torie · Nov 17, 2015 · Viewed 29.4k times · Source

I want to create a navbar with a white background and black text, but have been unable to get the text in the links within the navbar to be anything but white.

Things I've tried:
- adding the class "black-text" to the li tags, to the ul tag, to the surrounding div and nav tags
- defining a class in my application.scss file for each li tag.
- adding li, nav, a { color: black; } to my application.scss file

Here is the html for the navbar:

Answer

Edwin Carra picture Edwin Carra · May 7, 2016

As adding a style change to the html will work I would recommend staying within the materializecss framework that you have chosen.

<div class="nav-wrapper"></div>

The default to this nav bar background color is pink, but just add one of the built in colors/shades and you will get very cool effects.

<div class="nav-wrapper blue lighten-1></div>

Now my nav bar has a light blue background color. Same applies to the text.

<div class="card-panel">
      <span class="blue-text text-darken-2">This is a card panel with dark blue text</span>
</div>

This will produce a card panel with blue text. Hope this helps.

Answer based on http://materializecss.com/color.html