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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -