Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change hover color on nav-tabs

I want to change text color of hover nav-tabs, so I named : nav nav-tabs custom, so code in my view looks like this:

      <li class="active"><%= link_to "Overview", '#'  %>           
      </li>
      <li><%= link_to "About",    '#' %></li>
      <li><%= link_to "What we do", '#' %></li>
      <li><%= link_to "Partners", '#' %></li>
      <li><%= link_to "Contact", '#' %></li>
      <li><%= link_to "Support", '#' %></li>
    </ul>

and code in my custom.css.scss

.custom a:hover {color: black;}

and it doesn't work. Can someone help me ?

like image 480
deny7ko Avatar asked May 18 '12 06:05

deny7ko


People also ask

How to change tab in hover?

Create buttons to open the specific tab content. All <div> elements with class="tabcontent" are hidden by default (with CSS & JS) - when the user move the mouse over a button - it will open the tab content that "matches" this button.

How do I make my tab active in HTML?

To make the tabs toggleable, add the data-toggle="tab" attribute to each link. Then add a . tab-pane class with a unique ID for every tab and wrap them inside a <div> element with class . tab-content .


2 Answers

You need to make your selector a little bit more specific to properly target your tabs. Try this:

.custom > li > a:hover {
    color: black;
}

By the way, this only changes the color of the text, if you want to change the background color of the tabs upon hover switch that color property to background-color.

like image 138
Andres Ilich Avatar answered Oct 18 '22 00:10

Andres Ilich


Andres is right about the specificity. The style you want to override is set with:

.nav-bar > li > a:hover

If you're using LESS with Twitter Bootstrap there are variables already made for this:

@navbarLinkColor
@navbarLinkColorHover
@navbarLinkColorActive

See the Navbar section of the docs.

like image 42
Judd Lyon Avatar answered Oct 18 '22 01:10

Judd Lyon