Skip to content

Instantly share code, notes, and snippets.

@v1w3
Created December 27, 2017 15:47
Show Gist options
  • Save v1w3/b74db716f6f6c002fc235085e8d2ed2d to your computer and use it in GitHub Desktop.
Save v1w3/b74db716f6f6c002fc235085e8d2ed2d to your computer and use it in GitHub Desktop.
CSS3 Grid
<section>
<div>Normal size</div>
<div>Normal size</div>
<div>Double width</div>
<div>Normal size</div>
<div>Double Width</div>
<div>Double Height</div>
<div>Normal size</div>
<div>Normal size</div>
<div>Normal size</div>
<div>Normal size</div>
<div>Double Width</div>
<div>Normal size</div>
<div>Double Width</div>
<div>Normal size</div>
<div>Normal size</div>
</section>
section{
display:grid;
grid-template-columns:repeat(5fr);
grid-gap: 0.5em
}
section div{
background: #fff;
border: solid 0.2em #000;
height:50vh;
color:#000;
display:flex;
flex-direction:column;
justify-content:center;
text-align:center
}
section div:nth-child(3){
grid-column:3/5;
grid-row:1;
}
section div:nth-child(5){
grid-column:1/3;
grid-row:2;
}
section div:nth-child(6){
grid-column:3;
grid-row:2/4;
height:98.7%;
}
section div:nth-child(11){
grid-column:4/6;
grid-row:3;
}
section div:nth-child(13){
grid-column:2/4;
grid-row:4;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment