Skip to content

Instantly share code, notes, and snippets.

@chrillewoodz
Last active August 29, 2015 14:27
Show Gist options
  • Save chrillewoodz/29288da90e401823866f to your computer and use it in GitHub Desktop.
Save chrillewoodz/29288da90e401823866f to your computer and use it in GitHub Desktop.
Masonry grid system
$breakpoints: (xs, sm, md, lg);
$calculation: '';
@each $breakpoint in $breakpoints {
@for $i from 1 through 12 {
$calculation: 0% + ($i * 100 / 12);
.masonry-#{$breakpoint}-#{$i} {
@if $breakpoint == 'xs' {
width: $calculation;
}
@else if $breakpoint == 'sm' {
@media screen and (min-width: 768px) {
width: $calculation;
}
}
@else if $breakpoint == 'md' {
@media screen and (min-width: 992px) {
width: $calculation;
}
}
@else if $breakpoint == 'lg' {
@media screen and (min-width: 1200px) {
width: $calculation;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment