I'm trying to change the active color (after its clicked it remains twitter's light-blue color) for each tab:
<ul class="nav nav-pills"> <li class="active"><a href="#tab1" data-toggle="tab">Overview</a></li> <li><a href="#tab2" data-toggle="tab">Sample</a></li> <li><a href="#tab3" data-toggle="tab">Sample</a></li> </ul>
(How) can I do this in CSS?
There are two ways that you can change the font color of the active nav-item. The default font-color is white of the active nav-link in the case of Bootstrap nav-active item. The first-way approach is to use a CSS styling file and changing the nav-item class when clicked.
You can supply your own class to the nav-pills
container with your custom color for your active link, that way you can create as many colors as you like without modifying the bootstrap default colors in other sections of your page. Try this:
Markup
<ul class="nav nav-pills red"> <li class="active"><a href="#tab1" data-toggle="tab">Overview</a></li> <li><a href="#tab2" data-toggle="tab">Sample</a></li> <li><a href="#tab3" data-toggle="tab">Sample</a></li> </ul>
And here is the CSS for your custom color:
.red .active a, .red .active a:hover { background-color: red; }
Also, if you prefer to replace the default color for the .active
item in your nav-pills
you can modify the original like so:
.nav-pills > .active > a, .nav-pills > .active > a:hover { background-color: red; }
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