Created
June 22, 2014 01:42
-
-
Save soderalohastrom/581aff3c60dc877844e7 to your computer and use it in GitHub Desktop.
Create a responsive “gallery” of blocks
This file contains 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
* { | |
box-sizing: border-box; | |
} | |
body { | |
background: #222; | |
} | |
@mixin rowMachine($numPerRow, $margin) { | |
width: ((100% - (($numPerRow - 1) * $margin)) / $numPerRow); | |
&:nth-child(n) { | |
margin-bottom: $margin; | |
margin-right: $margin; | |
} | |
&:nth-child(#{$numPerRow}n) { | |
margin-right: 0; | |
margin-bottom: 0; | |
} | |
} | |
.person { | |
@include rowMachine(5, 2%); | |
background: white; | |
padding: 10px; | |
float: left; | |
@media (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