Skip to content

Instantly share code, notes, and snippets.

@blake-simpson
Created June 24, 2014 07:52
Show Gist options
  • Save blake-simpson/88f943901b395c19d749 to your computer and use it in GitHub Desktop.
Save blake-simpson/88f943901b395c19d749 to your computer and use it in GitHub Desktop.
CSS fluid (unknown N) children (LESS)
.fluid {
&:after {
content: "";
clear: both;
display: block;
}
.item {
float: left;
}
.item:first-child:nth-last-child(1) {
width: 100%;
}
.item:first-child:nth-last-child(2),
.item:first-child:nth-last-child(2) ~ .item {
width: 50%;
}
.item:first-child:nth-last-child(3),
.item:first-child:nth-last-child(3) ~ .item {
width: 33.3333%;
}
.item:first-child:nth-last-child(4),
.item:first-child:nth-last-child(4) ~ .item {
width: 25%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment