1

I am trying to change the color and background color of the active link in a boostrap's dropdown menu.

I have overriden bootstrap's @dropdownLinkColorActive and @dropdownLinkBackgroundActive variables but this has no effet.

The css for ".navbar-inverse .nav .active > a" takes over, as seen in firebug:

.navbar-inverse .nav .active > a, .navbar-inverse .nav .active > a:hover, .navbar-inverse .nav .active > a:focus { background-color: #FFFFFF; color: #4D4D4F; } .dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus { background-color: #16A170; background-image: linear-gradient(to bottom, #17AA76, #149466); background-repeat: repeat-x; color: #FFFFFF; outline: 0 none; text-decoration: none; } 

Why is the .navbar-inverse class overriding the .dropdown-menu class ?

2 Answers 2

4

Probably cause the dropdown is in the navbar.

This one should work

.dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus { background-color: #16A170 !important; background-image: linear-gradient(to bottom, #17AA76, #149466) !important; background-repeat: repeat-x !important; color: #FFFFFF; outline: 0 none; text-decoration: none; } 
Sign up to request clarification or add additional context in comments.

Comments

1

assume the backgroud-color you need is #fff write this:

.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus, .dropdown-submenu:hover > a, .dropdown-submenu:focus > a { text-decoration: none; color: #333333; background-color: #fff; background-image: -moz-linear-gradient(top, #fff, #fff); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#fff)); background-image: -webkit-linear-gradient(top, #fff, #fff); background-image: -o-linear-gradient(top, #fff, #fff); background-image: linear-gradient(to bottom, #fff, #fff); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff', endColorstr='#fff', GradientType=0); } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.