Skip to content

Instantly share code, notes, and snippets.

@4lun
Last active August 29, 2016 09:53
Show Gist options
  • Save 4lun/0ad68c70e83a4e075898 to your computer and use it in GitHub Desktop.
Save 4lun/0ad68c70e83a4e075898 to your computer and use it in GitHub Desktop.
Basic BEM CSS Grid
$breakpoint-lrg: 780px;
$breakpoint-med: 450px;
$grid-gutter: 15px;
.grid {
@extend %clearfix;
margin-left: -($grid-gutter);
&__col {
float: left;
padding-left: $grid-gutter;
min-height: 1px;
width: 100%;
@for $i from 1 through 12 {
&--sml-#{$i} {
width: (100%/12)*$i;
}
}
@media (min-width: $breakpoint-med) {
@for $i from 1 through 12 {
&--med-#{$i} {
width: (100%/12)*$i;
}
}
}
@media (min-width: $breakpoint-lrg) {
@for $i from 1 through 12 {
&--lrg-#{$i} {
width: (100%/12)*$i;
}
}
}
&--right {
float: right;
}
}
}
%clearfix {
&:before,
&:after {
content: " ";
display: table;
}
&:after {
clear: both;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment