Skip to content

Instantly share code, notes, and snippets.

@danilowoz
Created April 18, 2019 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danilowoz/2f2d05b211c444de69a4b49b66671545 to your computer and use it in GitHub Desktop.
Save danilowoz/2f2d05b211c444de69a4b49b66671545 to your computer and use it in GitHub Desktop.
.container {
display: flex;
flex-flow: column wrap;
align-content: space-between;
/* Your container needs a fixed height, and it
* needs to be taller than your tallest column. */
height: 600px;
}
.item {
width: 32%;
margin-bottom: 2%; /* Optional */
}
/* Re-order items into 3 rows */
.item:nth-child(3n+1) { order: 1; }
.item:nth-child(3n+2) { order: 2; }
.item:nth-child(3n) { order: 3; }
/* Force new columns */
.container::before,
.container::after {
content: "";
flex-basis: 100%;
width: 0;
order: 2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment