Change navbar bootstrap color to hover link?

I want to know how to change the color of links when you hover over them in the navigation bar, as they are currently an ugly color.

Thanks for any suggestions?

HTML:

<div class="container"> <div class="navbar"> <div class="navbar-inner"> <ul class="nav"> <li class="active"><a href="#">Home</a></li> <li><a href="#">Link One</a></li> <li><a href="#">Link Two</a></li> <li><a href="#">Link Three</a></li> </ul> </div> </div> </div> 
+56
html css colors twitter-bootstrap navbar
May 18 '13 at 15:35
source share
13 answers

For Bootstrap 3, this is how I did it based on the default Navbar structure:

 .navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus { background-color: #FFFF00; color: #FFC0CB; } 
+87
Oct. 06 '13 at 0:00
source share

This is cleaner:

 ul.nav a:hover { color: #fff !important; } 

No more specifying this. Unfortunately, in this case !important is needed.

I also added :focus and :active to the same ad for accessibility reasons and for users of smartphones / tablets / touch screens.

+48
Sep 27 '13 at 20:34 on
source share

You can try this to change the link background on hover

 .nav > li > a:hover{ background-color:#FCC; } 
+16
Jun 26 '15 at 6:31
source share

You will have to rewrite the CSS rule:

 .navbar-inverse .brand, .navbar-inverse .nav > li > a 

or

 .navbar .brand, .navbar .nav > li > a 

It depends if you use a dark or light theme, respectively. To do this, add CSS with your rewritten rules and make sure it goes into your HTML after Bootstrap CSS. For example:

 .navbar .brand, .navbar .nav > li > a { color: #D64848; } .navbar .brand, .navbar .nav > li > a:hover { color: #F56E6E; } 

There is also an alternative where you configure your own Boostrap here . In this case, in the Navbar section, you have @navbarLinkColor .

+6
May 18, '13 at 15:40
source share

Updated 2018

You can change the colors of Navbar links using CSS to override the colors of the bootstrap ...

Bootstrap 4

 .navbar-nav .nav-item .nav-link { color: red; } .navbar-nav .nav-item.active .nav-link, .navbar-nav .nav-item:hover .nav-link { color: pink; } 

Bootstrap 4 color demo of navigation bar link

Bootstrap 3

 .navbar .navbar-nav > li > a, .navbar .navbar-nav > .active > a{ color: orange; } .navbar .navbar-nav > li > a:hover, .navbar .navbar-nav > li > a:focus, .navbar .navbar-nav > .active > a:hover, .navbar .navbar-nav > .active > a:focus { color: red; } 

Bootstrap 3 demo navigation bar link




Change or customize the entire color of the Navbar , see https://stackoverflow.com/a/167189/

+6
Mar 21 '18 at 12:02
source share

Point the item you want to change and use !important to overwrite all existing styles assigned to that item. Be sure not to use the !important declaration unless it is absolutely necessary.

 div.navbar div.navbar-inner ul.nav a:hover { color: #fff !important; } 
+4
May 18 '13 at 15:45
source share
 .nav > li > a:focus, .nav > li > a:hover { text-decoration: underline; background-color: pink; } 
+4
Feb 10 '16 at 13:24
source share

Use the "Come" link, it is based on Bootstrap 3.0

 .navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus { background-color: #977EBD; color: #FFFFFF; } .navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus { background-color: #977EBD; color: #FFFFFF; } 
+3
Aug 21 '13 at 18:17
source share

Sorry for the late reply. You can use only:

  nav a:hover{ background-color:color name !important; } 
+3
Jun 07 '17 at 10:29 on
source share

Something like this worked for me (with Bootstrap 3):

 .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus{ font-family: proxima-nova; font-style: normal; font-weight: 100; letter-spacing: 3px; text-transform: uppercase; color: black; } 

In my case, I also wanted the link text to remain black until the hover, so I added .navbar-nav> li> a

 .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus, .navbar-nav > li > a{ font-family: proxima-nova; font-style: normal; font-weight: 100; letter-spacing: 3px; text-transform: uppercase; color: black; } 
+1
Jun 03 '14 at 15:20
source share

If you are Nabbar , follow these steps:

 <div class="navbar navbar-default navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">Project name</a> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li class="active"><a href="#">Home</a></li> <li><a href="#about">About</a></li> <li><a href="#contact">Contact</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="#">Action</a></li> <li><a href="#">Another action</a></li> <li><a href="#">Something else here</a></li> <li class="divider"></li> <li class="dropdown-header">Nav header</li> <li><a href="#">Separated link</a></li> <li><a href="#">One more separated link</a></li> </ul> </li> </ul> <ul class="nav navbar-nav navbar-right"> <li><a href="../navbar/">Default</a></li> <li><a href="../navbar-static-top/">Static top</a></li> <li class="active"><a href="./">Fixed top</a></li> </ul> </div><!--/.nav-collapse --> </div> 

Then just use the following CSS style to change the hover color of your navigation brand

 .navbar-default .navbar-brand:hover, .navbar-default .navbar-brand:focus { color: white; } 

Thus, the navigation color of the navbad-brand will be changed to white. I just tested it and it works for me correctly.

0
Aug 24 '13 at 21:50
source share

That should be enough:

 .nav.navbar-nav li a:hover { color: red; } 
0
Jan 08 '19 at 10:49
source share

 .navbar-default .navbar-nav > li > a{ color: #e9b846; } .navbar-default .navbar-nav > li > a:hover{ background-color: #e9b846; color: #FFFFFF; } 

0
Aug 19 '19 at 6:07
source share



All Articles