Skip to content

Instantly share code, notes, and snippets.

@fredcerdeira
Created March 7, 2015 21:05
Show Gist options
  • Select an option

  • Save fredcerdeira/b55d99bfc7c7ccce80d9 to your computer and use it in GitHub Desktop.

Select an option

Save fredcerdeira/b55d99bfc7c7ccce80d9 to your computer and use it in GitHub Desktop.
simple grid
%section
.grid
.col-12
%span
12
.col-6
%span
6
.col-6
%span
6
.col-8
%span
8
.col-4
%span
4
.col-2
%span
2
.col-10
%span
10
.col-9
%span
9
.col-3
%span
3
//demo layout
*,
*:before,
*:after {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
@mixin cf {
&:after {
content: "";
display: table;
clear: both;
}
}
section {
max-width: 90%;
margin: 50px auto;
background: plum;
padding-top: 1em;
}
span {
background: salmon;
display: block;
text-align: center;
color: white;
padding: 1em;
}
//grid
$grid-columns: 12;
$grid-max-width: 100%;
.grid {
padding: 0 10px;
width: 100%;
margin: 0 auto;
@include cf;
@media (min-width: 800px) {
max-width: $grid-max-width;
@for $i from 1 through $grid-columns {
.col-#{$i} {
width: 100% / $grid-columns * $i;
}
}
}
}
[class*='col-'] {
float: left;
padding: 0 10px;
width: 100%;
margin-bottom: 1em;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment