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/702e967c227359e1ee0d to your computer and use it in GitHub Desktop.

Select an option

Save lozandier/702e967c227359e1ee0d to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
.wrap
.content
%h2 Content
.gallery
-3.times do | i|
.gallery__item.level-1
%h2 Item #{i+1}
- if i < 2
- 2.times do | x |
.gallery__subitem.level-2
- if i > 0
%h2 SubItem #{x+1}
-else
%h2 SubItem #{x+3}
.full
%h2 Full Wide Item
.sidebar
%h2
Sidebar
// ----
// libsass (v3.2.5)
// ----
// Nested: 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)), global-box-sizing: border-box, container: 1140px, gutter-position: after);
$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: {
};
}
.content {
margin-top: 10vh;
background: rgba(113, 218, 210, 0.8);
@include span(6);
}
.sidebar {
margin-top: 10vh;
background: rgba(250, 231, 179, 0.8);
@include span(2 last);
a {
color: #666;
padding-left: 1rem;
line-height: 2;
text-decoration: none;
}
}
h2 {
padding: 1rem 0;
text-align: center;
color: #555;
}
.level-1:nth-child(odd) {
background: rgba(244, 49, 11, 0.5);
}
.level-1:nth-child(even){
background: rgba(250, 231, 179, 0.5);
}
.level-2:nth-child(odd){
background: rgba(20, 231, 179, 0.5);
}
.level-2:nth-child(even){
background: rgba(123, 222, 22, 0.5);
}
.full {
margin-top: 1rem;
background: rgba(123, 222, 22, 0.5);
}
h2 {
padding: 1rem 0;
text-align: center;
color: #555;
}
.gallery {
@include cf;
&__item {
@include cf;
@include nested(6){
@include gallery(2)
}
}
&__subitem {
@include nested(2) {
@include gallery(1);
/*
@include span(1);
&:last-child {
@include last;
}
*/
}
}
}
*, *:before, *:after {
-moz-box-sizing: border-box;
box-sizing: border-box;
}
img, 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;
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;
}
.wrap:after {
content: " ";
display: block;
clear: both;
}
.content {
margin-top: 10vh;
background: rgba(113, 218, 210, 0.8);
width: 74.35897%;
float: left;
margin-right: 2.5641%;
}
.sidebar {
margin-top: 10vh;
background: rgba(250, 231, 179, 0.8);
width: 23.07692%;
float: right;
margin-right: 0;
}
.sidebar a {
color: #666;
padding-left: 1rem;
line-height: 2;
text-decoration: none;
}
h2 {
padding: 1rem 0;
text-align: center;
color: #555;
}
.level-1:nth-child(odd) {
background: rgba(244, 49, 11, 0.5);
}
.level-1:nth-child(even) {
background: rgba(250, 231, 179, 0.5);
}
.level-2:nth-child(odd) {
background: rgba(20, 231, 179, 0.5);
}
.level-2:nth-child(even) {
background: rgba(123, 222, 22, 0.5);
}
.full {
margin-top: 1rem;
background: rgba(123, 222, 22, 0.5);
}
h2 {
padding: 1rem 0;
text-align: center;
color: #555;
}
.gallery:after {
content: " ";
display: block;
clear: both;
}
.gallery__item {
width: 31.03448%;
float: left;
}
.gallery__item:after {
content: " ";
display: block;
clear: both;
}
.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.48276%;
margin-right: -100%;
clear: none;
}
.gallery__item:nth-child(3n + 3) {
margin-left: 68.96552%;
margin-right: -100%;
clear: none;
}
.gallery__subitem {
width: 44.44444%;
float: left;
/*
@include span(1);
&:last-child {
@include last;
}
*/
}
.gallery__subitem:nth-child(2n + 1) {
margin-left: 0;
margin-right: -100%;
clear: both;
margin-left: 0;
}
.gallery__subitem:nth-child(2n + 2) {
margin-left: 55.55556%;
margin-right: -100%;
clear: none;
}
<div class='wrap'>
<div class='content'>
<h2>Content</h2>
<div class='gallery'>
<div class='gallery__item level-1'>
<h2>Item 1</h2>
<div class='gallery__subitem level-2'>
<h2>SubItem 3</h2>
</div>
<div class='gallery__subitem level-2'>
<h2>SubItem 4</h2>
</div>
</div>
<div class='gallery__item level-1'>
<h2>Item 2</h2>
<div class='gallery__subitem level-2'>
<h2>SubItem 1</h2>
</div>
<div class='gallery__subitem level-2'>
<h2>SubItem 2</h2>
</div>
</div>
<div class='gallery__item level-1'>
<h2>Item 3</h2>
</div>
<div class='full'>
<h2>Full Wide Item</h2>
</div>
</div>
</div>
<div class='sidebar'>
<h2>
Sidebar
</h2>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment