Bootstrap: drop-down color change

I am currently using this template: http://getbootstrap.com/examples/navbar-fixed-top/

Is there a way to give the background in the drop-down menu (the one that appears when the navigation bar falls down) a different color than the navigation bar itself?

What I have tried so far is without success:

.navbar-default .navbar-nav .open .dropdown-menu > .active > a,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
    color: #555555;
    background-color: #e7e7e7;
}
+7
source share
7 answers

Use this

.navbar-nav > li > .dropdown-menu { background-color: #FF0000; }
+17
source

, , CSS, , HTML . CSS , . .

/* Dropdown menu background color*/

.navbar-nav > li > .dropdown-menu {     background-color: #e7e7e7;  }

/* Dropdown menu font color*/ 

 .navbar-nav > li > .dropdown-menu a{   color: #555555;  }
+6

try it

.dropdown-menu > .active > a,.dropdown-menu > .active > a:hover.dropdown-menu > .active > a:focus {color: #555555!important; background-color: #e7e7e7!important;}
+1
source
ul.dropdown-menu {
    background-color: #000;
}
0
source

you can use the appropriate @media screen value

To change the original ul background, use the following code:

@media (max-width: 768px){
.dropdown-menu{

/*property: value;*/
}
}
0
source
.nav .open>a {background: #yourcolor !important;}
0
source

If you click the drop-down menu, the boot class added the "open" class so that you can overwrite it as follows:

.navbar-default .navbar-nav > .open > a, 
.navbar-default .navbar-nav > .open > a:focus,
.navbar-default .navbar-nav > .open > a:hover {
    color: #555;
    background-color: #e7e7e7;
}    
0
source

Source: https://habr.com/ru/post/1540869/


All Articles