Skip to content

Instantly share code, notes, and snippets.

@castastrophe
Last active September 12, 2017 20:27
Show Gist options
  • Save castastrophe/eb22d8dca826fdb9225836ee4d40a0d4 to your computer and use it in GitHub Desktop.
Save castastrophe/eb22d8dca826fdb9225836ee4d40a0d4 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
> 1%
last 2 versions
<div class="container">
<div class="box">1</div>
<div class="box">2</div>
<div class="box">3</div>
<div class="box">4</div>
<div class="box">5</div>
<div class="box">6</div>
<div class="box">7</div>
</div>
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
.container {
display: grid;
grid-template-columns: repeat(6, 1fr);
grid-gap: 10px;
> * {
&:not(:nth-child(n+3)) {
grid-column: span 3;
color: red;
}
&:nth-child(n+3) {
grid-column: span 2;
color: blue;
}
}
}
.box {
min-width: 200px;
min-height: 100px;
background: lightgray;
font-size: 2em;
display: flex;
align-items: center;
justify-content: center;
}
.container {
display: grid;
grid-template-columns: repeat(6, 1fr);
grid-gap: 10px;
}
.container > *:not(:nth-child(n+3)) {
grid-column: span 3;
color: red;
}
.container > *:nth-child(n+3) {
grid-column: span 2;
color: blue;
}
.box {
min-width: 200px;
min-height: 100px;
background: lightgray;
font-size: 2em;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
}
<div class="container">
<div class="box">1</div>
<div class="box">2</div>
<div class="box">3</div>
<div class="box">4</div>
<div class="box">5</div>
<div class="box">6</div>
<div class="box">7</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment