Last active
August 29, 2015 14:11
-
-
Save bensmithett/795323966995725384fe to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or 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="grid"> | |
<div class="grid__col"><div class="content">foo</div></div> | |
<div class="grid__col"><div class="content">foo</div></div> | |
<div class="grid__col"><div class="content">foo</div></div> | |
</div> | |
<div class="grid -gutters"> | |
<div class="grid__col"><div class="content">foo</div></div> | |
<div class="grid__col"><div class="content">foo</div></div> | |
<div class="grid__col"><div class="content">foo</div></div> | |
</div> | |
<div class="grid -gutters"> | |
<div class="grid__col"><div class="content">foo</div></div> | |
<div class="grid__col -span-7"><div class="content">foo</div></div> | |
</div> |
This file contains hidden or 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.4.9) | |
// Compass (v1.0.1) | |
// ---- | |
* | |
box-sizing: border-box | |
$gutter: 10px | |
.grid | |
display: flex | |
flex-wrap: wrap | |
&.-gutters | |
margin-left: -$gutter | |
> .grid__col | |
padding-left: $gutter | |
&.-align-top | |
align-items: flex-start | |
&.-align-bottom | |
align-items: flex-end | |
&.-align-center | |
align-items: center | |
.grid__col | |
flex: 1 | |
@for $i from 1 through 10 | |
&.-span-#{$i} | |
flex: none | |
width: $i * 10% | |
&.-align-right | |
text-align: right | |
// Not part of grid, for demo only | |
.grid | |
background: green | |
padding-top: 10px | |
padding-bottom: 10px | |
margin-bottom: 5px | |
.grid__col | |
background: red | |
padding-top: 10px | |
padding-bottom: 10px | |
.content | |
background: blue | |
This file contains hidden or 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
* { | |
box-sizing: border-box; | |
} | |
.grid { | |
display: flex; | |
flex-wrap: wrap; | |
} | |
.grid.-gutters { | |
margin-left: -10px; | |
} | |
.grid.-gutters > .grid__col { | |
padding-left: 10px; | |
} | |
.grid.-align-top { | |
align-items: flex-start; | |
} | |
.grid.-align-bottom { | |
align-items: flex-end; | |
} | |
.grid.-align-center { | |
align-items: center; | |
} | |
.grid__col { | |
flex: 1; | |
} | |
.grid__col.-span-1 { | |
flex: none; | |
width: 10%; | |
} | |
.grid__col.-span-2 { | |
flex: none; | |
width: 20%; | |
} | |
.grid__col.-span-3 { | |
flex: none; | |
width: 30%; | |
} | |
.grid__col.-span-4 { | |
flex: none; | |
width: 40%; | |
} | |
.grid__col.-span-5 { | |
flex: none; | |
width: 50%; | |
} | |
.grid__col.-span-6 { | |
flex: none; | |
width: 60%; | |
} | |
.grid__col.-span-7 { | |
flex: none; | |
width: 70%; | |
} | |
.grid__col.-span-8 { | |
flex: none; | |
width: 80%; | |
} | |
.grid__col.-span-9 { | |
flex: none; | |
width: 90%; | |
} | |
.grid__col.-span-10 { | |
flex: none; | |
width: 100%; | |
} | |
.grid__col.-align-right { | |
text-align: right; | |
} | |
.grid { | |
background: green; | |
padding-top: 10px; | |
padding-bottom: 10px; | |
margin-bottom: 5px; | |
} | |
.grid__col { | |
background: red; | |
padding-top: 10px; | |
padding-bottom: 10px; | |
} | |
.content { | |
background: blue; | |
} |
This file contains hidden or 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="grid"> | |
<div class="grid__col"><div class="content">foo</div></div> | |
<div class="grid__col"><div class="content">foo</div></div> | |
<div class="grid__col"><div class="content">foo</div></div> | |
</div> | |
<div class="grid -gutters"> | |
<div class="grid__col"><div class="content">foo</div></div> | |
<div class="grid__col"><div class="content">foo</div></div> | |
<div class="grid__col"><div class="content">foo</div></div> | |
</div> | |
<div class="grid -gutters"> | |
<div class="grid__col"><div class="content">foo</div></div> | |
<div class="grid__col -span-7"><div class="content">foo</div></div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment