Created
February 22, 2015 14:49
-
-
Save bearded-avenger/3a7c2c05d0bd45c754e2 to your computer and use it in GitHub Desktop.
Grid Layout - CSS - nth child
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
// this targets 1,5,7,11,13,17,19... | |
.ale--66 { | |
&:nth-child(6n+1), | |
&:nth-child(6n+5){ | |
width:66.666%; | |
} | |
} | |
// this targets - 2,4,8,10,14,16,20.... | |
.ale--33 { | |
&:nth-child(6n+4), | |
&:nth-child(6n+2) { | |
width:33.333%; | |
} | |
} | |
.ale--clear__float{ | |
&:nth-child(3n+1), | |
&:nth-child(3n+2) { | |
height:200px; | |
float: left; | |
} | |
} | |
.ale--full { | |
&:nth-child(3n+3) { | |
clear: left; | |
width:100%; | |
height:300px; | |
// bump the height of every other full up to 500px | |
&:nth-child(odd) { | |
height:500px; | |
} | |
} | |
} |
I was trying to do this, couldn't work it out. You're awesome.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
aids in producing http://cl.ly/image/2B0V091H3c2c