Skip to content

Instantly share code, notes, and snippets.

@HHRy
Last active August 29, 2015 14:21
Show Gist options
  • Save HHRy/23b5a851eef4b98ab97e to your computer and use it in GitHub Desktop.
Save HHRy/23b5a851eef4b98ab97e to your computer and use it in GitHub Desktop.
Simple CSS Grid (SASS)
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
.row {
*zoom: 1;
padding-top: 2px;
padding-bottom: 2px;
&:before, &:after {
content: " ";
display: table;
}
&:after {
clear: both;
}
.col {
display: block;
float: left;
height: auto;
padding-left: 2px;
padding-right: 2px;
}
.half {
@extend .col;
width: 50%;
}
.full {
@extend .col;
width: 100%;
}
.quarter {
@extend .col;
width: 25%;
}
.threequarters {
@extend .col;
width: 75%;
}
.fifth {
@extend .col;
width: 20%;
}
.third {
@extend .col;
width: 33.33%;
}
.twothirds {
@extend .col;
width: 66.66%;
}
}
body.show-grid {
.row {
border-bottom: 1px dashed green;
background-color: rgba(0,255,0,0.1);
.col, .half, .full, .quarter, .fifth, .third, .twothirds {
border-left: 1px dotted blue;
background-color: rgba(0,0,255,0.1);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment