3 ms·
Most nesting I do uses the '&' parent selector, so it's not "real" nesting. .a-long-class-name { background: firebrick; &:hover { backg
by frosted-flakes 8y ago
Most nesting I do uses the '&' parent selector, so it's not "real" nesting.
.a-long-class-name {
background: firebrick;
&:hover {
background: red;
}
}
This approach has some clear benefits (less verbose and it groups related code together) with little or no downsides.
- nkozyra 8y agoSame, but this can definitely get long, ala & > div, & a, & a { &:hover } etc.
- frosted-flakes 8y agoYour example is a bit confusing. This would be a more idiomatic way of writing it: .some-class { > div, a { background: blue; &:hover { background: red; } } }
- have_faith 8y agoThe solution is to not write css like this... ;)