设置所有锚点/链接的样式:
.navbar li a {
color: blue !important;
}
ul:
下的样式锚点/链接.navbar ul li a {
color: blue !important;
}
我想实现两种不同的场景:
答案 0 :(得分:1)
你的意思是所有嵌套链接都不应该是蓝色的吗?如果这样改变css如下。
.navbar li a {
color: blue !important;
}
/* Link under ul only */
.navbar ul.dropdown-menu li a {
color:initial !important;
}
答案 1 :(得分:0)
使用此选择器仅设置第一个ul的样式。并且底色不同
.navbar-nav > li > a {
color: blue !important;
}
看到这个小提琴:https://jsfiddle.net/v2xmc150/2/