Reputation: 1306
Hi i have this code:
.navbar .nav-pills .active > a {
background-color: $NavBgHighlight;
color: $NavTxtColor;
}
.navbar .nav-pills .active > a:hover {
background-color: $NavBgHighlight;
color: $NavTxtColor;
}
I wanted to merge both of the sections into one section, something more like:
.navbar .nav-pills .active > a, a:hover {
background-color: $NavBgHighlight;
color: $NavTxtColor;
}
But it doesnt work that way :( how can i merge both of them? ( I want that the :hover and the normal a will act the same)
Upvotes: 12
Views: 22471
Reputation: 30531
You can use SASS selector nesting:
.navbar .nav-pills .active {
> a, > a:hover {
background-color: $NavBgHighlight;
color: $NavTxtColor;
}
}
Which compiles to:
.navbar .nav-pills .active > a, .navbar .nav-pills .active > a:hover {
...
}
Upvotes: 19
Reputation: 62
.navbar{
&.nav-pills{
&.active {
> a, > a:hover {
background-color: $NavBgHighlight;
color: $NavTxtColor;
}
}
}
}
Upvotes: 4