Skip to content

Instantly share code, notes, and snippets.

@kevinruscoe
Created March 9, 2017 20:43
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 kevinruscoe/7f9c8b7f29e44c333254267cac958a2c to your computer and use it in GitHub Desktop.
Save kevinruscoe/7f9c8b7f29e44c333254267cac958a2c to your computer and use it in GitHub Desktop.
$cols: 12;
$gap: .5rem;
.css-grid {
display: grid;
grid-template-columns: repeat($cols, auto);
grid-gap: $gap $gap;
@for $col from 1 to ($cols+1) {
.span-#{$col} {
grid-column: span #{$col};
}
}
}
.flex-grid {
display: flex;
flex-wrap: wrap;
@for $col from 1 to ($cols+1) {
.span-#{$col} {
width: calc( #{((100%/12)*$col)} - #{($gap * 2)});
margin: 0 $gap ($gap * 2);
}
}
}
.float-grid {
@for $col from 1 to ($cols+1) {
.span-#{$col} {
float: left;
width: calc( #{((100%/12)*$col)} - #{($gap * 2)});
margin: 0 $gap ($gap * 2);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment