Last active
August 29, 2015 13:55
-
-
Save PhilippeVay/8755112 to your computer and use it in GitHub Desktop.
LESS: parent selector '&' combined with 'if' when()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* &:focus, &:hover, &:active isn't the only way of using the parent selector in LESS */ | |
@rtl_option: true; | |
ul, ol { | |
padding-left: 2em; | |
/* RTL */ | |
[dir="rtl"] & when (@rtl_option) { | |
padding-left: 0; | |
padding-right: 2em; | |
} | |
} | |
/* | |
Should output: | |
ul, ol { | |
padding-left: 2em; | |
} | |
/* RTL */ | |
[dir="rtl"] ul, | |
[dir="rtl"] ol { | |
padding-left: 0; | |
padding-right: 2em; | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment