2013-06-26 105 views
1

我想改變boostrap下拉菜單中活動鏈接的顏色和背景顏色。Bootstrap:改變下拉菜單的活動鏈接顏色

我已經覆蓋引導程序的@dropdownLinkColorActive和@dropdownLinkBackgroundActive變量,但這沒有效果。

爲CSS「.navbar逆.nav。主動>一個」接管,如在螢火蟲:

.navbar-inverse .nav .active > a, .navbar-inverse .nav .active > a:hover, .navbar-inverse .nav .active > a:focus { 
    background-color: #FFFFFF; 
    color: #4D4D4F; 
} 

.dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus { 
    background-color: #16A170; 
    background-image: linear-gradient(to bottom, #17AA76, #149466); 
    background-repeat: repeat-x; 
    color: #FFFFFF; 
    outline: 0 none; 
    text-decoration: none; 
} 

爲什麼.navbar逆類中重寫.dropdown菜單類?

回答

3

可能導致下拉菜單位於導航欄中。

這一個應該工作

.dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active  >  a:focus { 
    background-color: #16A170 !important; 
    background-image: linear-gradient(to bottom, #17AA76, #149466) !important; 
    background-repeat: repeat-x !important; 
    color: #FFFFFF; 
    outline: 0 none; 
    text-decoration: none; 
} 
1

假設你所需要的研究背景色是#FFF 這樣寫:

.dropdown-menu > li > a:hover, 
.dropdown-menu > li > a:focus, 
.dropdown-submenu:hover > a, 
.dropdown-submenu:focus > a { 
    text-decoration: none; 
    color: #333333; 
    background-color: #fff; 
    background-image: -moz-linear-gradient(top, #fff, #fff); 
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#fff)); 
    background-image: -webkit-linear-gradient(top, #fff, #fff); 
    background-image: -o-linear-gradient(top, #fff, #fff); 
    background-image: linear-gradient(to bottom, #fff, #fff); 
    background-repeat: repeat-x; 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff', endColorstr='#fff', GradientType=0); 
}