Skip to content

Instantly share code, notes, and snippets.

@lozandier
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save lozandier/62ef095fd335513ca5d9 to your computer and use it in GitHub Desktop.

Select an option

Save lozandier/62ef095fd335513ca5d9 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
%header.site-header
.wrap
.logo
%a{ href: "#" }
Logo
%nav
%ul
- 5.times do | i |
%a{ href: "#" }
item0#{i}
.wrap
%main.content
%h2 Gallery Content
%ul.gallery
- 15.times do | i |
%li.gallery__item
%img{ src: "http://www.placehold.it/250x250&text=item#{i}" }
%aside.sidebar
%h2
Sidebar
%ul
- 5.times do
%li
%a{ href: "#" } A link to someplace else
.site-footer
.wrap
- 4.times do |i|
.widget
%h2
Widget
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// Breakpoint (v2.5.0)
// Susy (v2.2.5)
// Toolkit (v2.9.0)
// ----
// Second edition after review feedback from me & others; practice makes perfect
@import "susy";
@import "toolkit";
@import "toolkit/kickstart";
@import "breakpoint";
//Variables
$breakpoint-to-ems: true;
$susy: ( columns: 8, debug: (image: show, color: rgba(#66f, .25), output: overlay), global-box-sizing: border-box, container: 1140px);
$tablet: 600px;
$desktop: 980px;
// Mixins
@mixin cf {
&:after {
content: " ";
display: block;
clear: both;
}
}
:root {
font-family: sans-serif;
}
ul, ol, li {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
.wrap {
@include container();
padding: {
};
@include breakpoint($tablet) {
@include show-grid(9);
}
@include breakpoint($desktop){
@include show-grid(16)
}
}
.site-header, .site-footer {
background: rgba(234, 159, 195, 0.8);
}
.site-header {
a {
color: #555;
text-decoration: none;
}
}
.logo {
float: left;
line-height: 2rem;
font-size: 1.5rem;
}
nav {
float: right;
li {
list-style: none;
float: left;
margin-left: 1em;
line-height: 2rem;
}
}
.content {
margin-top: 10vh;
background: rgba(113, 218, 210, 0.8);
@include susy-breakpoint($desktop, 16){
@include span(12 of 16);
}
}
.sidebar {
margin-top: 10vh;
background: rgba(250, 231, 179, 0.8);
@include susy-breakpoint($desktop, 16) {
@include span(4 of 16 last);
}
a {
color: #666;
padding-left: 1rem;
line-height: 2;
text-decoration: none;
}
}
.widget {
background: rgba(240, 150, 113, 0.8);
}
h2 {
padding: 1rem 0;
text-align: center;
color: #555;
}
.gallery {
background: rgb(200, 200, 2);
@include cf;
@include susy-breakpoint($desktop, 12){
width: span(10 of 12);
margin-left: span(1 wide of 12);
}
// === margin-left: span(1 of 12) + gutter(12)
@include susy-breakpoint(max-width $tablet, 8) {
@include nested(8){
&__item {
margin-bottom: gutter();
@include gallery(4)
}
}
}
@include susy-breakpoint(max-width $desktop, 9){
&__item {
margin-bottom: gutter();
@include gallery(3 of 9);
}
}
@include susy-breakpoint($desktop, 16) {
@include nested(10){
&__item {
margin-bottom: gutter();
@include gallery(2);
}
}
}
&__item {
/*
@include span( 2 of 10);
margin-bottom: gutter(10);
&:nth-child(5n) {
@include last
}
*/
}
}
.widget {
@include gallery( 4 of 16 )
}
html {
-moz-box-sizing: border-box;
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
embed,
img,
object,
video {
max-width: 100%;
height: auto;
}
:root {
font-family: sans-serif;
}
ul, ol, li {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
.wrap {
max-width: 1140px;
margin-left: auto;
margin-right: auto;
}
.wrap:after {
content: " ";
display: block;
clear: both;
}
head {
display: block;
position: fixed;
right: 10px;
top: 10px;
z-index: 999;
color: #333;
background: rgba(255, 255, 255, 0.25);
}
head:before {
content: "|||";
display: block;
padding: 5px 10px;
font-family: sans-serif;
font-size: 16px;
font-weight: bold;
}
head:hover {
background: rgba(255, 255, 255, 0.5);
color: red;
}
head:hover ~ .wrap, head:hover ~ body .wrap {
position: relative;
}
head:hover ~ .wrap:before, head:hover ~ body .wrap:before {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
content: " ";
z-index: 998;
background-image: linear-gradient(to right, rgba(102, 102, 255, 0.25), rgba(179, 179, 255, 0.25) 80%, transparent 80%);
background-size: 12.82051%;
background-origin: content-box;
background-clip: content-box;
background-position: left top;
}
@media (min-width: 37.5em) {
head:hover ~ .wrap, head:hover ~ body .wrap {
position: relative;
}
head:hover ~ .wrap:before, head:hover ~ body .wrap:before {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
content: " ";
z-index: 998;
background-image: linear-gradient(to right, rgba(102, 102, 255, 0.25), rgba(179, 179, 255, 0.25) 80%, transparent 80%);
background-size: 11.36364%;
background-origin: content-box;
background-clip: content-box;
background-position: left top;
}
}
@media (min-width: 61.25em) {
head:hover ~ .wrap, head:hover ~ body .wrap {
position: relative;
}
head:hover ~ .wrap:before, head:hover ~ body .wrap:before {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
content: " ";
z-index: 998;
background-image: linear-gradient(to right, rgba(102, 102, 255, 0.25), rgba(179, 179, 255, 0.25) 80%, transparent 80%);
background-size: 6.32911%;
background-origin: content-box;
background-clip: content-box;
background-position: left top;
}
}
.site-header, .site-footer {
background: rgba(234, 159, 195, 0.8);
}
.site-header a {
color: #555;
text-decoration: none;
}
.logo {
float: left;
line-height: 2rem;
font-size: 1.5rem;
}
nav {
float: right;
}
nav li {
list-style: none;
float: left;
margin-left: 1em;
line-height: 2rem;
}
.content {
margin-top: 10vh;
background: rgba(113, 218, 210, 0.8);
}
@media (min-width: 61.25em) {
.content {
width: 74.68354%;
float: left;
margin-right: 1.26582%;
}
}
.sidebar {
margin-top: 10vh;
background: rgba(250, 231, 179, 0.8);
}
@media (min-width: 61.25em) {
.sidebar {
width: 24.05063%;
float: right;
margin-right: 0;
}
}
.sidebar a {
color: #666;
padding-left: 1rem;
line-height: 2;
text-decoration: none;
}
.widget {
background: rgba(240, 150, 113, 0.8);
}
h2 {
padding: 1rem 0;
text-align: center;
color: #555;
}
.gallery {
background: #c8c802;
}
.gallery:after {
content: " ";
display: block;
clear: both;
}
@media (min-width: 61.25em) {
.gallery {
width: 83.05085%;
margin-left: 8.47458%;
}
}
@media (max-width: 37.5em) {
.gallery__item {
margin-bottom: 2.5641%;
width: 48.71795%;
float: left;
}
.gallery__item:nth-child(2n + 1) {
margin-left: 0;
margin-right: -100%;
clear: both;
margin-left: 0;
}
.gallery__item:nth-child(2n + 2) {
margin-left: 51.28205%;
margin-right: -100%;
clear: none;
}
}
@media (max-width: 61.25em) {
.gallery__item {
margin-bottom: 2.27273%;
width: 31.81818%;
float: left;
}
.gallery__item:nth-child(3n + 1) {
margin-left: 0;
margin-right: -100%;
clear: both;
margin-left: 0;
}
.gallery__item:nth-child(3n + 2) {
margin-left: 34.09091%;
margin-right: -100%;
clear: none;
}
.gallery__item:nth-child(3n + 3) {
margin-left: 68.18182%;
margin-right: -100%;
clear: none;
}
}
@media (min-width: 61.25em) {
.gallery__item {
margin-bottom: 2.04082%;
width: 18.36735%;
float: left;
}
.gallery__item:nth-child(5n + 1) {
margin-left: 0;
margin-right: -100%;
clear: both;
margin-left: 0;
}
.gallery__item:nth-child(5n + 2) {
margin-left: 20.40816%;
margin-right: -100%;
clear: none;
}
.gallery__item:nth-child(5n + 3) {
margin-left: 40.81633%;
margin-right: -100%;
clear: none;
}
.gallery__item:nth-child(5n + 4) {
margin-left: 61.22449%;
margin-right: -100%;
clear: none;
}
.gallery__item:nth-child(5n + 5) {
margin-left: 81.63265%;
margin-right: -100%;
clear: none;
}
}
.gallery__item {
/*
@include span( 2 of 10);
margin-bottom: gutter(10);
&:nth-child(5n) {
@include last
}
*/
}
.widget {
width: 24.05063%;
float: left;
}
.widget:nth-child(4n + 1) {
margin-left: 0;
margin-right: -100%;
clear: both;
margin-left: 0;
}
.widget:nth-child(4n + 2) {
margin-left: 25.31646%;
margin-right: -100%;
clear: none;
}
.widget:nth-child(4n + 3) {
margin-left: 50.63291%;
margin-right: -100%;
clear: none;
}
.widget:nth-child(4n + 4) {
margin-left: 75.94937%;
margin-right: -100%;
clear: none;
}
<header class='site-header'>
<div class='wrap'>
<div class='logo'>
<a href='#'>
Logo
</a>
</div>
<nav>
<ul>
<a href='#'>
item00
</a>
<a href='#'>
item01
</a>
<a href='#'>
item02
</a>
<a href='#'>
item03
</a>
<a href='#'>
item04
</a>
</ul>
</nav>
</div>
</header>
<div class='wrap'>
<main class='content'>
<h2>Gallery Content</h2>
<ul class='gallery'>
<li class='gallery__item'>
<img src='http://www.placehold.it/250x250&amp;text=item0'>
</li>
<li class='gallery__item'>
<img src='http://www.placehold.it/250x250&amp;text=item1'>
</li>
<li class='gallery__item'>
<img src='http://www.placehold.it/250x250&amp;text=item2'>
</li>
<li class='gallery__item'>
<img src='http://www.placehold.it/250x250&amp;text=item3'>
</li>
<li class='gallery__item'>
<img src='http://www.placehold.it/250x250&amp;text=item4'>
</li>
<li class='gallery__item'>
<img src='http://www.placehold.it/250x250&amp;text=item5'>
</li>
<li class='gallery__item'>
<img src='http://www.placehold.it/250x250&amp;text=item6'>
</li>
<li class='gallery__item'>
<img src='http://www.placehold.it/250x250&amp;text=item7'>
</li>
<li class='gallery__item'>
<img src='http://www.placehold.it/250x250&amp;text=item8'>
</li>
<li class='gallery__item'>
<img src='http://www.placehold.it/250x250&amp;text=item9'>
</li>
<li class='gallery__item'>
<img src='http://www.placehold.it/250x250&amp;text=item10'>
</li>
<li class='gallery__item'>
<img src='http://www.placehold.it/250x250&amp;text=item11'>
</li>
<li class='gallery__item'>
<img src='http://www.placehold.it/250x250&amp;text=item12'>
</li>
<li class='gallery__item'>
<img src='http://www.placehold.it/250x250&amp;text=item13'>
</li>
<li class='gallery__item'>
<img src='http://www.placehold.it/250x250&amp;text=item14'>
</li>
</ul>
</main>
<aside class='sidebar'>
<h2>
Sidebar
</h2>
<ul>
<li>
<a href='#'>A link to someplace else</a>
</li>
<li>
<a href='#'>A link to someplace else</a>
</li>
<li>
<a href='#'>A link to someplace else</a>
</li>
<li>
<a href='#'>A link to someplace else</a>
</li>
<li>
<a href='#'>A link to someplace else</a>
</li>
</ul>
</aside>
</div>
<div class='site-footer'>
<div class='wrap'>
<div class='widget'>
<h2>
Widget
</h2>
</div>
<div class='widget'>
<h2>
Widget
</h2>
</div>
<div class='widget'>
<h2>
Widget
</h2>
</div>
<div class='widget'>
<h2>
Widget
</h2>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment