Skip to content

Instantly share code, notes, and snippets.

@mirisuzanne
Last active January 3, 2016 00:19
Show Gist options
  • Save mirisuzanne/8381773 to your computer and use it in GitHub Desktop.
Save mirisuzanne/8381773 to your computer and use it in GitHub Desktop.
Susy One Tutorial: Mobile-First Magic Grids [part 1]
<div class="page">
<header class="banner">
<p>Banner</p>
</header>
<nav class="pagenav">
<p><a href="#">Page Nav</a></p>
</nav>
<main class="main">
<aside class="summary">
<p>Summary</p>
</aside>
<article class="content">
<p>Main Content</p>
</article>
</main>
<footer class="contentinfo">
<p>Content Info</p>
</footer>
</div>
// ----
// Sass (v3.2.13)
// Compass (v0.12.2)
// Susy (v1.0.9)
// ----
// imports
// -------
@import "compass";
@import "compass/reset";
@import "susy";
// settings
// --------
$total-columns : 7;
$column-width : 4em;
$gutter-width : 1em;
$grid-padding : $gutter-width;
// mobile layout
// -------------
.page { @include container; }
.contentinfo { @include bleed($grid-padding); }
// a bit of style...
// -----------------
$grid-background-column-color: rgba(#aad, .25);
@include establish-baseline;
html {
font-family: sans-serif;
color: #444;
}
.page { @include susy-grid-background; }
header { font-weight: bold; }
aside { font-style: italic; }
footer { background: rgba(#fcc, .75); }
p {
margin: 0;
padding: 1em 0;
}
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
}
html {
line-height: 1;
}
ol, ul {
list-style: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
caption, th, td {
text-align: left;
font-weight: normal;
vertical-align: middle;
}
q, blockquote {
quotes: none;
}
q:before, q:after, blockquote:before, blockquote:after {
content: "";
content: none;
}
a img {
border: none;
}
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary {
display: block;
}
.page {
*zoom: 1;
max-width: 34em;
_width: 34em;
padding-left: 1em;
padding-right: 1em;
margin-left: auto;
margin-right: auto;
}
.page:after {
content: "";
display: table;
clear: both;
}
.contentinfo {
margin-left: -1em;
padding-left: 1em;
margin-right: -1em;
padding-right: 1em;
}
* html {
font-size: 100%;
}
html {
font-size: 16px;
line-height: 1.5em;
}
html {
font-family: sans-serif;
color: #444;
}
.page {
background-image: -webkit-gradient(linear, 0% 50%, 100% 50%, color-stop(0%, rgba(0, 0, 0, 0)), color-stop(0%, rgba(170, 170, 221, 0.25)), color-stop(11.76471%, rgba(170, 170, 221, 0.25)), color-stop(11.76471%, rgba(0, 0, 0, 0)), color-stop(14.70588%, rgba(0, 0, 0, 0)), color-stop(14.70588%, rgba(170, 170, 221, 0.25)), color-stop(26.47059%, rgba(170, 170, 221, 0.25)), color-stop(26.47059%, rgba(0, 0, 0, 0)), color-stop(29.41176%, rgba(0, 0, 0, 0)), color-stop(29.41176%, rgba(170, 170, 221, 0.25)), color-stop(41.17647%, rgba(170, 170, 221, 0.25)), color-stop(41.17647%, rgba(0, 0, 0, 0)), color-stop(44.11765%, rgba(0, 0, 0, 0)), color-stop(44.11765%, rgba(170, 170, 221, 0.25)), color-stop(55.88235%, rgba(170, 170, 221, 0.25)), color-stop(55.88235%, rgba(0, 0, 0, 0)), color-stop(58.82353%, rgba(0, 0, 0, 0)), color-stop(58.82353%, rgba(170, 170, 221, 0.25)), color-stop(70.58824%, rgba(170, 170, 221, 0.25)), color-stop(70.58824%, rgba(0, 0, 0, 0)), color-stop(73.52941%, rgba(0, 0, 0, 0)), color-stop(73.52941%, rgba(170, 170, 221, 0.25)), color-stop(85.29412%, rgba(170, 170, 221, 0.25)), color-stop(85.29412%, rgba(0, 0, 0, 0)), color-stop(88.23529%, rgba(0, 0, 0, 0)), color-stop(88.23529%, rgba(170, 170, 221, 0.25)), color-stop(100%, rgba(170, 170, 221, 0.25)), color-stop(100%, rgba(0, 0, 0, 0)), color-stop(100%, rgba(0, 0, 0, 0)));
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0) 0%, rgba(170, 170, 221, 0.25) 0%, rgba(170, 170, 221, 0.25) 11.76471%, rgba(0, 0, 0, 0) 11.76471%, rgba(0, 0, 0, 0) 14.70588%, rgba(170, 170, 221, 0.25) 14.70588%, rgba(170, 170, 221, 0.25) 26.47059%, rgba(0, 0, 0, 0) 26.47059%, rgba(0, 0, 0, 0) 29.41176%, rgba(170, 170, 221, 0.25) 29.41176%, rgba(170, 170, 221, 0.25) 41.17647%, rgba(0, 0, 0, 0) 41.17647%, rgba(0, 0, 0, 0) 44.11765%, rgba(170, 170, 221, 0.25) 44.11765%, rgba(170, 170, 221, 0.25) 55.88235%, rgba(0, 0, 0, 0) 55.88235%, rgba(0, 0, 0, 0) 58.82353%, rgba(170, 170, 221, 0.25) 58.82353%, rgba(170, 170, 221, 0.25) 70.58824%, rgba(0, 0, 0, 0) 70.58824%, rgba(0, 0, 0, 0) 73.52941%, rgba(170, 170, 221, 0.25) 73.52941%, rgba(170, 170, 221, 0.25) 85.29412%, rgba(0, 0, 0, 0) 85.29412%, rgba(0, 0, 0, 0) 88.23529%, rgba(170, 170, 221, 0.25) 88.23529%, rgba(170, 170, 221, 0.25) 100%, rgba(0, 0, 0, 0) 100%, rgba(0, 0, 0, 0) 100%);
background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0) 0%, rgba(170, 170, 221, 0.25) 0%, rgba(170, 170, 221, 0.25) 11.76471%, rgba(0, 0, 0, 0) 11.76471%, rgba(0, 0, 0, 0) 14.70588%, rgba(170, 170, 221, 0.25) 14.70588%, rgba(170, 170, 221, 0.25) 26.47059%, rgba(0, 0, 0, 0) 26.47059%, rgba(0, 0, 0, 0) 29.41176%, rgba(170, 170, 221, 0.25) 29.41176%, rgba(170, 170, 221, 0.25) 41.17647%, rgba(0, 0, 0, 0) 41.17647%, rgba(0, 0, 0, 0) 44.11765%, rgba(170, 170, 221, 0.25) 44.11765%, rgba(170, 170, 221, 0.25) 55.88235%, rgba(0, 0, 0, 0) 55.88235%, rgba(0, 0, 0, 0) 58.82353%, rgba(170, 170, 221, 0.25) 58.82353%, rgba(170, 170, 221, 0.25) 70.58824%, rgba(0, 0, 0, 0) 70.58824%, rgba(0, 0, 0, 0) 73.52941%, rgba(170, 170, 221, 0.25) 73.52941%, rgba(170, 170, 221, 0.25) 85.29412%, rgba(0, 0, 0, 0) 85.29412%, rgba(0, 0, 0, 0) 88.23529%, rgba(170, 170, 221, 0.25) 88.23529%, rgba(170, 170, 221, 0.25) 100%, rgba(0, 0, 0, 0) 100%, rgba(0, 0, 0, 0) 100%);
background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0) 0%, rgba(170, 170, 221, 0.25) 0%, rgba(170, 170, 221, 0.25) 11.76471%, rgba(0, 0, 0, 0) 11.76471%, rgba(0, 0, 0, 0) 14.70588%, rgba(170, 170, 221, 0.25) 14.70588%, rgba(170, 170, 221, 0.25) 26.47059%, rgba(0, 0, 0, 0) 26.47059%, rgba(0, 0, 0, 0) 29.41176%, rgba(170, 170, 221, 0.25) 29.41176%, rgba(170, 170, 221, 0.25) 41.17647%, rgba(0, 0, 0, 0) 41.17647%, rgba(0, 0, 0, 0) 44.11765%, rgba(170, 170, 221, 0.25) 44.11765%, rgba(170, 170, 221, 0.25) 55.88235%, rgba(0, 0, 0, 0) 55.88235%, rgba(0, 0, 0, 0) 58.82353%, rgba(170, 170, 221, 0.25) 58.82353%, rgba(170, 170, 221, 0.25) 70.58824%, rgba(0, 0, 0, 0) 70.58824%, rgba(0, 0, 0, 0) 73.52941%, rgba(170, 170, 221, 0.25) 73.52941%, rgba(170, 170, 221, 0.25) 85.29412%, rgba(0, 0, 0, 0) 85.29412%, rgba(0, 0, 0, 0) 88.23529%, rgba(170, 170, 221, 0.25) 88.23529%, rgba(170, 170, 221, 0.25) 100%, rgba(0, 0, 0, 0) 100%, rgba(0, 0, 0, 0) 100%);
background-image: linear-gradient(left, rgba(0, 0, 0, 0) 0%, rgba(170, 170, 221, 0.25) 0%, rgba(170, 170, 221, 0.25) 11.76471%, rgba(0, 0, 0, 0) 11.76471%, rgba(0, 0, 0, 0) 14.70588%, rgba(170, 170, 221, 0.25) 14.70588%, rgba(170, 170, 221, 0.25) 26.47059%, rgba(0, 0, 0, 0) 26.47059%, rgba(0, 0, 0, 0) 29.41176%, rgba(170, 170, 221, 0.25) 29.41176%, rgba(170, 170, 221, 0.25) 41.17647%, rgba(0, 0, 0, 0) 41.17647%, rgba(0, 0, 0, 0) 44.11765%, rgba(170, 170, 221, 0.25) 44.11765%, rgba(170, 170, 221, 0.25) 55.88235%, rgba(0, 0, 0, 0) 55.88235%, rgba(0, 0, 0, 0) 58.82353%, rgba(170, 170, 221, 0.25) 58.82353%, rgba(170, 170, 221, 0.25) 70.58824%, rgba(0, 0, 0, 0) 70.58824%, rgba(0, 0, 0, 0) 73.52941%, rgba(170, 170, 221, 0.25) 73.52941%, rgba(170, 170, 221, 0.25) 85.29412%, rgba(0, 0, 0, 0) 85.29412%, rgba(0, 0, 0, 0) 88.23529%, rgba(170, 170, 221, 0.25) 88.23529%, rgba(170, 170, 221, 0.25) 100%, rgba(0, 0, 0, 0) 100%, rgba(0, 0, 0, 0) 100%);
background-position: left top;
-webkit-background-origin: content;
-moz-background-origin: content;
-ms-background-origin: content-box;
-o-background-origin: content-box;
background-origin: content-box;
-webkit-background-clip: content-box;
-moz-background-clip: content-box;
background-clip: content-box;
}
header {
font-weight: bold;
}
aside {
font-style: italic;
}
footer {
background: rgba(255, 204, 204, 0.75);
}
p {
margin: 0;
padding: 1em 0;
}
<div class="page">
<header class="banner">
<p>Banner</p>
</header>
<nav class="pagenav">
<p><a href="#">Page Nav</a></p>
</nav>
<main class="main">
<aside class="summary">
<p>Summary</p>
</aside>
<article class="content">
<p>Main Content</p>
</article>
</main>
<footer class="contentinfo">
<p>Content Info</p>
</footer>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment