Skip to content

Instantly share code, notes, and snippets.

@Undistraction
Created October 27, 2015 11:53
Show Gist options
  • Save Undistraction/c3b1eee877940a08a719 to your computer and use it in GitHub Desktop.
Save Undistraction/c3b1eee877940a08a719 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="Flexbox">
<div class="Flexbox-child"></div>
<div class="Flexbox-child"></div>
</div>
<div class="Flexbox">
<div class="Flexbox-child"></div>
<div class="Flexbox-child"></div>
<div class="Flexbox-child"></div>
</div>
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
.Flexbox {
background: grey;
margin-bottom:10px;
width: 49%;
float: left;
height: 500px;
display: flex;
align-content: stretch;
flex-direction: column;
+.Flexbox {
float: right;
}
&-child {
min-height: 20px;
flex: 1 1 auto;
margin: 5px 0;
&:first-child {
margin-top:0;
}
&:last-child {
margin-bottom:0;
}
&:nth-child(3n+1) {
background: red;
}
&:nth-child(3n+2) {
background: green;
}
&:nth-child(3n+3) {
background: blue;
}
}
}
.Flexbox {
background: grey;
margin-bottom: 10px;
width: 49%;
float: left;
height: 500px;
display: flex;
align-content: stretch;
flex-direction: column;
}
.Flexbox + .Flexbox {
float: right;
}
.Flexbox-child {
min-height: 20px;
flex: 1 1 auto;
margin: 5px 0;
}
.Flexbox-child:first-child {
margin-top: 0;
}
.Flexbox-child:last-child {
margin-bottom: 0;
}
.Flexbox-child:nth-child(3n+1) {
background: red;
}
.Flexbox-child:nth-child(3n+2) {
background: green;
}
.Flexbox-child:nth-child(3n+3) {
background: blue;
}
<div class="Flexbox">
<div class="Flexbox-child"></div>
<div class="Flexbox-child"></div>
</div>
<div class="Flexbox">
<div class="Flexbox-child"></div>
<div class="Flexbox-child"></div>
<div class="Flexbox-child"></div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment