Search code examples
htmlcssmaterialize

How to change text color for all links in Materialize CSS navbar?


How do you change the text color for all navbar links including brand logo in Materialize css. I tries to add like 'black-text' but it only works for the brand-logo. For example,

<a id="logo-container" href="#" class="brand-logo black-text">
    My Logo
</a>

<ul class="right hide-on-med-and-down black-text">
    <li><a href=#">Link 1</a> 
</li></ul>

Again 'black-text' only works for the logo.


Solution

  • In your css, add:

    .black-text li a{
      color: black;
     }
    

    alternately, you can add the "black-text" class directly to all the links you want to have black text.
    example:

           <ul class="right hide-on-med-and-down black-text">
             <li><a class ="black-text" href=#">Link 1</a> 
          </li></ul>