Skip to content

Instantly share code, notes, and snippets.

@ijmccallum
Created June 3, 2016 18:10
Show Gist options
  • Save ijmccallum/c160016e01ca9baf5018cd604b42188f to your computer and use it in GitHub Desktop.
Save ijmccallum/c160016e01ca9baf5018cd604b42188f to your computer and use it in GitHub Desktop.
How simple can I make this?
//took this: https://css-tricks.com/dont-overthink-it-grids/ and tweaked it
$pad: 40px;
.grid {
&:after {
content: "";
display: table;
clear: both;
}
&--pad {
/* Opt-in outside padding */
.grid-pad {
padding: $pad 0 $pad $pad;
[class*='col-']:last-of-type {
padding-right: $pad;
}
}
}
//by default all columns float left, to float right use .pull-right
[class*='__col'] {
float: left;
padding-right: $pad;
&:last-of-type {
padding-right: 0;
}
}
.grid__col--no-padding { //some extra specificity juice to override the above [class*='']
padding-right: 0;
padding-left: 0;
}
//even more specificity for the same cause
&.grid { .grid__col--right-padding { padding-right: $pad; } }
&.grid { .grid__col--left-padding { padding-left: $pad; } }
&__col--1-half { width: 50%; }
&__col--1-third { width: 33.33%; }
&__col--2-third { width: 66.66%; }
&__col--1-quarter { width: 25%; }
&__col--3-quarter { width: 75%; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment