Created
December 11, 2014 13:53
-
-
Save kokarn/243fd0acbb89045f657a to your computer and use it in GitHub Desktop.
LESS mixin for using nth-child on IE7 & IE8
This file contains 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
.clear-nth( @selector, @n, @currentSelector: '', @i: 1 ) when ( mod( @i, @n + 1 ) = 0 ) and ( @i < 100 ){ | |
@updatedSelector: e( '@{currentSelector} + @{selector}' ); | |
@{updatedSelector} { | |
clear: both; | |
} | |
.clear-nth( @selector, @n, @updatedSelector, ( @i + 1 ) ); | |
} | |
.clear-nth( @selector, @n, @currentSelector: '', @i: 1 ) when not ( mod( @i, @n + 1 ) = 0 ) and ( @i < 100 ) and not( @i = 1 ){ | |
@updatedSelector: e( '@{currentSelector} + @{selector}' ); | |
.clear-nth( @selector, @n, @updatedSelector, ( @i + 1 ) ); | |
} | |
.clear-nth( @selector, @n, @currentSelector: '', @i: 1 ) when not ( mod( @i, @n + 1 ) = 0 ) and ( @i < 100 ) and ( @i = 1 ){ | |
@updatedSelector: e( '@{selector}:first-child' ); | |
.clear-nth( @selector, @n, @updatedSelector, ( @i + 1 ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment