newcoder1010 Posted October 23, 2015 Share Posted October 23, 2015 Hi, I have the below code which works. .navbar-default .navbar-nav>.active>a, .navbar-default .navbar-nav>.active>a:focus { color: #ffffff; Font-weight: bold; background-color: #191970; } .navbar-default .navbar-nav>li>a { color: blue; Font-weight: bold; background-color: red; } I like to make background color red when I hover over the menu links. Below code works for active link only. I am not sure how can I set background red for active and non active links. .navbar-default .navbar-nav>.active>a:hover { color: #ffffff; Font-weight: bold; background-color: red; } Can you please help? Thank you. Link to comment Share on other sites More sharing options...
Ash! Posted October 23, 2015 Share Posted October 23, 2015 Hi, I think you just have to replace .active with li in your code... .navbar-default .navbar-nav > li > a:hover { color: #ffffff; Font-weight: bold; background-color: red; } This will remove the specification for active link and the red bg effect will be applied to all menu items on hover. Link to comment Share on other sites More sharing options...
newcoder1010 Posted October 23, 2015 Author Share Posted October 23, 2015 (edited) The code you gave me works for inactive links. I had to write one for active and one for inactive. active: .navbar-default .navbar-nav>.active>a:hover { color: #ffffff; Font-weight: bold; background-color: red; } Inactive: .navbar-default .navbar-nav > li > a:hover { color: #ffffff; Font-weight: bold; background-color: red; } Thank you. Edited October 23, 2015 by newcoder1010 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now