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)
SASS/SCSS code to select multiple select classes in the same item. In SCSS, parent selector & symbol is used. This & will be resolved side by side after compilation for CSS.
Example# When you group CSS selectors, you apply the same styles to several different elements without repeating the styles in your style sheet. Use a comma to separate multiple grouped selectors. So the blue color applies to all <div> elements and all <p> elements.
To group selectors, separate each selector with a comma.
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 {
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With