Last active
February 23, 2016 18:58
-
-
Save zeroeth/94e87a4a5adff3ed595a to your computer and use it in GitHub Desktop.
360 degrees of CSS child selection
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
| /* Try it out at http://lesscss.org/less-preview/ */ | |
| /* ~"" unquotes the strings in less. */ | |
| /* Im sure you could remove the double first arguments of "*" "*" but thats a task for another day */ | |
| /* Loop structure from http://meri-stuff.blogspot.com.br/2013/03/less-css-tips-and-trics.html */ | |
| /* looping mixin */ | |
| .loop (@index, @token, @selector, @joiner) when (@index > 0) { | |
| /* do whatever you need to do */ | |
| @{selector} { | |
| border: 2px solid hsl(@index, 100%, 50%); | |
| } | |
| /* loop */ | |
| .loop((@index - 1), @token, ~"@{selector} @{token}", @joiner); | |
| } | |
| /* stop mixin */ | |
| .loop (@index) when (@index <= 0) { | |
| loop: end; | |
| } | |
| /* use looping mixin */ | |
| .loop(360, ~"*", ~"*", " "); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment