Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change the color of class active in bootstrap

i'm trying to change the color of class active in my html code. i'm creating nav sidebar. here's my code:

<div class="col-sm-2">
                <ul class="nav nav-pills nav-stacked nav-static"> <!--stacked untuk jadi vertical -->
                    <li class="active"><a>Create Case</a></li>
                    <li><a href="wf-listofcase.php">List of cases</a></li>
                    <li><a href="linksofapps.html">Links of Apps</a></li>
                </ul>
    </div>

how to change its color? thanks before..

like image 370
sang Avatar asked Jul 14 '15 02:07

sang


People also ask

How do I change the active tab color in Bootstrap?

You can always modify your navigation list through css. Use this css code instead, in that way use you use the a tag to change the color and its background-color. It's improper to use the li tag to set the background only and a tag to set the color of the text.

How do I change the color of active NAV?

Hence, the background color of an active nav-item can be changed in the following manner by changing the background-color CSS property. Example: html.

How do I change the color of Bootstrap links?

You can use . text-reset class to reset the color from default blue to anything you want.


2 Answers

You can use:

.active a{
    color: red !important;
}

Or to avoid !important, use:

.nav-pills > li.active > a{
    color: red;
}

DEMO

like image 141
lmgonzalves Avatar answered Sep 17 '22 20:09

lmgonzalves


The following code applies red color for all the anchor tags.

a {
   color: red !important;
  }

To apply the color only within the "nav-static" wrapper, use the following code.

.nav-static .active a{
   color: red !important;
}
like image 26
prajeesh Avatar answered Sep 18 '22 20:09

prajeesh