Jump to content
Sign in to follow this  
newcoder1010

How to set background color for not active a links

Recommended Posts

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.

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 by newcoder1010

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...