4 ms·
I agree about CSS variables. I'm unsure about the merits of nesting. Tends to make for some hard-to-read code.
by nkozyra 8y ago
I agree about CSS variables.
I'm unsure about the merits of nesting. Tends to make for some hard-to-read code.
- frosted-flakes 8y agoMost 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... ;)
- dmitriid 8y agoCompared to BEM's .b-text-input__text-field or .b-select__option_selected or .media__img--rev nesting is a concise readable breath of fresh air