Skip to content

Instantly share code, notes, and snippets.

@barneycarroll
Last active October 11, 2015 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barneycarroll/3781098 to your computer and use it in GitHub Desktop.
Save barneycarroll/3781098 to your computer and use it in GitHub Desktop.
OOCSS grids without classitis for IE9 and above
.line,
.line > :nth-child(n+2):last-child{
overflow: hidden;
}
.line > *{
float:left;
}
.line > :nth-child(1):nth-last-child(2){
width:50%;
}
.line > :nth-child(1):nth-last-child(3),
.line > :nth-child(2):nth-last-child(2){
width:33.33333%;
}
.line > :nth-child(1):nth-last-child(4),
.line > :nth-child(2):nth-last-child(3),
.line > :nth-child(3):nth-last-child(2){
width:25%;
}
.line > :nth-child(1):nth-last-child(5),
.line > :nth-child(2):nth-last-child(4),
.line > :nth-child(3):nth-last-child(3),
.line > :nth-child(4):nth-last-child(2){
width:20%;
}
.line > :last-child{
float:none;
width:auto;
}
.line > :only-child{
float:none;
overflow:visible;
}
@barneycarroll
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment