Skip to content

Instantly share code, notes, and snippets.

@Beraliv
Last active January 11, 2018 08:54
Show Gist options
  • Save Beraliv/a95f449d4e96565b1a92a14961411ecb to your computer and use it in GitHub Desktop.
Save Beraliv/a95f449d4e96565b1a92a14961411ecb to your computer and use it in GitHub Desktop.
Less patterns
/* different parameters based on number of elements */
.selector:nth-last-child(2):first-child {
&, & ~ .selector {
// setting parameter, i.e.: flex-basis: 50%;
}
}
.selector:nth-last-child(3):first-child {
&, & ~ .selector {
// setting parameter, i.e.: flex-basis: 33.33%;
}
}
.selector:nth-last-child(4):first-child {
&, & ~ .selector {
// setting parameter, i.e.: flex-basis: 25%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment