Materialize: Can't change tab text nor underline color

Created on 18 Jan 2015  路  22Comments  路  Source: Dogfalo/materialize

How do you change a tab bar text and underline color?

Most helpful comment

^ The above worked for me to change the tab's underline color, but I had to use background-color:

.tabs .indicator {
    background-color: <ur color>;
}

All 22 comments

added to Sass variables in e837e79bdcc46a2ded5d125e2e55d60159ad6c27

It would be great to be able to change the underline color with HTML, like we can with other elements.

Just use
div class="indicator orange" style="z-index:1" /div
before the
/ul

this worked for me:
override in your css file the following rule:

.tabs .indicator {
    color: <ur color>;
}

^ The above worked for me to change the tab's underline color, but I had to use background-color:

.tabs .indicator {
    background-color: <ur color>;
}

Neither of these is working here.

@joaosardinha did you put !important after the color?

.tabs .indicator { background-color: <ur color> !important; }

saadq's answer works perfectly. To be clear, however:
.tabs .indicator { background-color: #99cc00; }
The <ur color> needs to be an actual color, without the <> symbols
I needed to do a force refresh before seeing the change.

Building onto @BrenoMazieiro so that his code is readable

Add this right before the </ul>

<div class="indicator orange" style="z-index:1"></div>

No one has stated how to change the text color? That salmon color is disgusting.

@Native-Coder

.tabs .tab a.active {
  color: <my-color>;
}

.tabs .tab a:hover {
  color: <my-color>;
}

.tabs .tab a {
  color: <my-color>;
}

notice .active is not a pseudo class, but an actual class name.

combo of things mentioned:

  1. active is indeed a css class here. my markup is a yellow scheme
.tab a.active {
  color:rgb(252, 234, 37)!important;
  background-color:rgb(3, 169, 244)!important;
}

2.I add the indicator and "color of your choice" classes AFTER the

    <ul class="tabs tabs-fixed-width light-blue">
                       <div class="indicator yellow" style="z-index:1"></div>
    

    I battled with this absolutely heinous pink for a few hours.

Thanks benjaminadk! puting the div after ul did the trick!

WIth JQuery

```
// TAB Color
$(".tabs" ).css("background-color", themeColor);

// TAB Indicator/Underline Color
$(".tabs>.indicator").css("background-color", '#FFF');

// TAB Text Color
$(".tabs>li>a").css("color", '#FFF');

```

where theme color is the color of your choice

the tab colors can be set with the usual classes red, brown, blue, etc

these were the parts i had to do css to change (thanks to everyone above but nobody had all these put together for me)

.tab a.active {
  color:rgb(252, 234, 37)!important;
  background-color:#448AFF!important;
}
.tabs .tab a:hover {
  background-color: #bcaaa4!important;
  color:#FFFFFF!important;
}
.tabs .tab a {
  color: #efebe9!important;
}
.tabs .indicator{
  background-color:#FFFFFF!important;
}

I am working with angular 6 I tried all of your solutions but none of them has worked:

This is my actual code:

<div class="row">
    <div class="col s12 m12 l12 xl12">
      <ul class="tabs tabs-fixed-width" id="chartstabs">
          <div class="indicator orange" style="z-index:1"></div>
        <li class="tab" *ngFor="let view of views">
          <a href="#tab{{view.id}}" (click)="loadTab(view)">{{view.name}}</a>
        </li>
      </ul>
    </div>
  </div>

And when I use this css is not working:

.tabs .indicator {
    background-color: blue !important; 
}

OR

.li .indicator {
    background-color: blue !important;
}

I have tried the
<div class="indicator indigo darken-4" style="z-index:1"></div>

And it did not working.

I am using materialize 1.0.0, just updated today.

WIth JQuery

  // TAB Color
   $(".tabs" ).css("background-color", themeColor);

   // TAB Indicator/Underline Color
   $(".tabs>.indicator").css("background-color", '#FFF');

   // TAB Text Color
   $(".tabs>li>a").css("color", '#FFF');

where theme color is the color of your choice

Awesome!

I am working with angular 6 I tried all of your solutions but none of them has worked:

This is my actual code:

<div class="row">
    <div class="col s12 m12 l12 xl12">
      <ul class="tabs tabs-fixed-width" id="chartstabs">
          <div class="indicator orange" style="z-index:1"></div>
        <li class="tab" *ngFor="let view of views">
          <a href="#tab{{view.id}}" (click)="loadTab(view)">{{view.name}}</a>
        </li>
      </ul>
    </div>
  </div>

And when I use this css is not working:

.tabs .indicator {
    background-color: blue !important; 
}

OR

.li .indicator {
    background-color: blue !important;
}

I have tried the
<div class="indicator indigo darken-4" style="z-index:1"></div>

And it did not working.

I am using materialize 1.0.0, just updated today.

I'm getting the same bug

I am working with angular 6 I tried all of your solutions but none of them has worked:
This is my actual code:

<div class="row">
    <div class="col s12 m12 l12 xl12">
      <ul class="tabs tabs-fixed-width" id="chartstabs">
          <div class="indicator orange" style="z-index:1"></div>
        <li class="tab" *ngFor="let view of views">
          <a href="#tab{{view.id}}" (click)="loadTab(view)">{{view.name}}</a>
        </li>
      </ul>
    </div>
  </div>

And when I use this css is not working:

.tabs .indicator {
    background-color: blue !important; 
}

OR

.li .indicator {
    background-color: blue !important;
}

I have tried the
<div class="indicator indigo darken-4" style="z-index:1"></div>
And it did not working.
I am using materialize 1.0.0, just updated today.

I'm getting the same bug

.tabs .indicator {

background-color: blue !important;

}

attach this lines in styles.css

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexknipfer picture alexknipfer  路  3Comments

ericlormul picture ericlormul  路  3Comments

ReiiYuki picture ReiiYuki  路  3Comments

MickaelH974 picture MickaelH974  路  3Comments

hartwork picture hartwork  路  3Comments