Created
January 31, 2014 19:30
-
-
Save benjamincharity/8741264 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="window"> | |
<section></section> | |
<aside></aside> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.3.0.rc.2) | |
// Compass (v1.0.0.alpha.17) | |
// ---- | |
// | |
// SET UP GRID FUNCTIONS | |
// | |
$site-width: 100%; | |
// total width of page | |
$width : $site-width; | |
// number of columns | |
$columns: 12; | |
// margin between columns | |
$col_margin: 1%; | |
//mixin to provide a clear to modern browsers IE8 and up | |
@mixin clear { | |
&::after { | |
clear: both; | |
content: ""; | |
display: table; | |
} | |
} | |
// maths | |
$col_width: ($width - ($col_margin * ($columns - 1))) / $columns; | |
$col_total_width: $col_width + $col_margin; | |
// create containing row | |
@mixin row() { | |
@include clear; | |
width: $width; | |
} | |
// create a column | |
@mixin col($n: 1) { | |
float: left; | |
@include span($n); | |
} | |
// make an element span N columns | |
@mixin span($n: 1) { | |
width: ($n * $col_width) + (($n - 1) * $col_margin); | |
@if $n == $columns { | |
margin-right: 0; | |
} | |
@else { | |
margin-right: $col_margin; | |
} | |
} | |
// the last column in a row needs this | |
@mixin last() { | |
margin-right: 0; | |
} | |
// if you need to overwrite a previous `last()`, use this | |
@mixin resetLast() { | |
margin-right: $col_margin; | |
} | |
// prepend n blank columns | |
@mixin prepend($n: 1) { | |
margin-left: $col_total_width * $n | |
} | |
// append n blank columns | |
@mixin append($n: 1) { | |
margin-right: $col_total_width * $n + $col_margin | |
} | |
// | |
// END GRID SET UP - BEGIN REAL STYLES | |
// | |
html, | |
body { | |
padding: 0; | |
margin: 0; | |
} | |
.window { | |
@include row; | |
} | |
section { | |
@include col(12); | |
background-color: lightblue; | |
height: 200px; | |
@media (min-width: 60em) { | |
@include col(8); | |
} | |
} | |
aside { | |
@include col(12); | |
background-color: pink; | |
height: 200px; | |
@media (min-width: 60em) { | |
@include col(4); | |
@include last(); | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html, | |
body { | |
padding: 0; | |
margin: 0; | |
} | |
.window { | |
width: 100%; | |
} | |
.window::after { | |
clear: both; | |
content: ""; | |
display: table; | |
} | |
section { | |
float: left; | |
width: 100%; | |
margin-right: 0; | |
background-color: lightblue; | |
height: 200px; | |
} | |
@media (min-width: 60em) { | |
section { | |
float: left; | |
width: 66.33333%; | |
margin-right: 1%; | |
} | |
} | |
aside { | |
float: left; | |
width: 100%; | |
margin-right: 0; | |
background-color: pink; | |
height: 200px; | |
} | |
@media (min-width: 60em) { | |
aside { | |
float: left; | |
width: 32.66667%; | |
margin-right: 1%; | |
margin-right: 0; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="window"> | |
<section></section> | |
<aside></aside> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment