Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change active link color in bootstrap css?

I am using joomla 3 and bootstrap.min.js I am creating menu and giving special class in order to change hover, active, visited links and style of the menu. I could not find how to change active link color of menu. Suppose I have 2 menu. Home and Contact. When I am in Home it is red, I want to change this color. I could change a:active and a:hover. Here is code;

.topmenu .active a,
.topmenu .active a:hover {
    background-color: white;
}
.topmenu > li > a{
    color: orange;
    font-weight:bold;
}
.topmenu > li > a:hover {
    color: black;
    background:white;
} 

Even I used div to change color of active link. Here is code

#top-menu a{
background-color: white;
color: orange;
font-weight:bold;
}
#top-menu a:focus
{
    color: orange;
}
#top-menu a:hover{
    color: black;
}

Every time when I click to Home it is activated and the color is red. What I want to change it to orange. Can not find how to do it.

Here is my markup code

<div id="top-menu">
<ul class="nav menu nav-pills topmenu">
<li class="item-109 current active"><a href="/joomla3/">Home</a></li>
<li class="item-138"><a href="/joomla3/?Itemid=138"> Russian </a></li>
<li class="item-110"><a href="/joomla3/?Itemid=110"></a></li></ul>
</div>

What do you suggest me to do?

like image 918
Firdavs Kurbonov Avatar asked May 15 '13 05:05

Firdavs Kurbonov


People also ask

How can I change bootstrap active nav link color?

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. The second-way approach is to change the color using jQuery .

How do I style a bootstrap link?

text-reset and Text Decoration . text-decoration-none are Bootstrap 4 options for achieving this. this should be the correct answer, simply adding 2 bootstrap built-in classes solve the problem!

How do I change the color of a link after clicking?

To change the color of hyperlink text, click Hyperlink, and then click More Colors. To change the color of the followed hyperlink text, click Followed Hyperlink, and then click More Colors.


1 Answers

For change the current active link color we can use code in external css file or inline css

.active a
{
background-color:#ff0000;
}
like image 93
Ranvir gorai Avatar answered Oct 21 '22 09:10

Ranvir gorai