4

I followed this post for customizing navbar. meanwhile I came across link which uses a simple navbar class. So I borrowed this from there

.navbar.navbar-www {
    background-color: #3E8956;
    border-color: #3E8956;
}

and the nav declared as follows in the above link:

<nav class="navbar navbar-fixed-top navbar-inverse navbar-www" role="navigation">

I had my custom.css loaded after bootstrap.css and my custom.css had the above css for navbar-www. even after that, my navbar is still in black color (navbar-inverse). but in the developer tools, I could see it is over-written to my custom.css background color for navbar-www.

I cannot figure out why this is happening and how to fix this?

EDIT: fixed a typo for the class .navbar .navbar-www

Community
  • 1
  • 1
brain storm
  • 30,124
  • 69
  • 225
  • 393

4 Answers4

0

The strength of the selector .navbar.navbar-www could be improved. Probably other browsers may understand that yours is more important than the other. Try being more specific on the selector and it won't be overwritten anymore!

For example:

  • .navbar.navbar-www.navbar-fixed-top
  • .navbar.navbar-www.navbar-inverse
  • .navbar.navbar-www.navbar-inverse.navbar-fixed-top
  • .someClass .navbar.navbar-www
  • nav.navbar.navbar-www
falsarella
  • 12,217
  • 9
  • 69
  • 115
0

try adding style to anchor tag

.navbar.navbar-www a{
  background-color: #3E8956;
  border-color: #3E8956;
}
krozero
  • 5,929
  • 3
  • 21
  • 33
0

Write you custom CSS fill as follow

.navbar.navbar-www {
    background-image: linear-gradient(rgb(240, 16, 16) 0px, rgb(249, 18, 18) 100%);
    border-color: #3E8956;
}

your problem will be resolved.

you can refer the bootstrap official document, you can find that the default navbar background described as background-image, the priority of background-image and background-color, distinct the background-image is more powerful than background-color.

Ammar Bayg
  • 105
  • 10
wuxianghou
  • 93
  • 1
  • 1
  • 5
0

Here is what I did, and it should work fine In your CSS file:

 .navbar.navbar-xxx{
   background-color: #000000;
   border-color: #c0392b;
 }
Tenz
  • 535
  • 2
  • 7
  • 27