LESS selector for element and child? -
with less how can apply styles both selector , selector within it?
my demo need apply opacity , z-index class a, , label come directly after it.
.a { color: red; opacity: 0.9; z-index: 2; & + label { color: blue; opacity: 0.9; z-index: 2; } }
here complete answer, others same doubt. achieve desired result, original code become:
solution 1:
.a { &, & + label { color: red; opacity: 0.9; z-index: 2; } & + label { color: blue; } }
firstly define common properties both selectors ,
separator , you'll override color
property & + label
one.
solution 2:
if want, achieve same result using first class .a
mixin , overriding again color
property:
.a { color: red; opacity: 0.9; z-index: 2; } + label { .a; color: blue; }
Comments
Post a Comment