Skip to content

Instantly share code, notes, and snippets.

@soderalohastrom
Created June 22, 2014 01:48
Show Gist options
  • Save soderalohastrom/d480d15ef8b807494aa6 to your computer and use it in GitHub Desktop.
Save soderalohastrom/d480d15ef8b807494aa6 to your computer and use it in GitHub Desktop.
Slightly changed rowMachine
* {
box-sizing: border-box;
}
body {
background: #222;
}
@mixin rowMachine($numPerRow, $margin) {
width: ((100% - (($numPerRow - 1) * $margin)) / $numPerRow);
&:nth-child(n) {
margin-right: $margin;
}
&:nth-child(#{$numPerRow}n) {
margin-right: 0;
}
&:nth-child(#{$numPerRow}n+1) {
clear: left;
}
}
.person {
background: white;
padding: 10px;
margin-bottom: 20px;
float: left;
@media (min-width: 1200px) {
@include rowMachine(4, 2%);
}
@media (min-width: 900px) and (max-width: 1200px) {
@include rowMachine(4, 2%);
}
@media (max-width: 900px) {
@include rowMachine(3, 4%);
}
img {
max-width: 100%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment