Last active
October 5, 2017 04:00
-
-
Save davemac/ebff99a6723d9f313621d6465c0f55bb to your computer and use it in GitHub Desktop.
Responsive content grid with flexbox and scss
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
.flex-row{ | |
display: flex; | |
// shorthand for flex-direction & flex-wrap | |
flex-flow: row wrap; | |
justify-content: space-between; | |
align-items: flex-start; | |
@media #{$small-only} { | |
display: block; | |
} | |
.flex-item{ | |
margin-bottom: 12px; | |
} | |
} | |
.dmc-half{ | |
.flex-item{ | |
// shorthand for flex-grow, flex-shrink & flex-basis | |
flex: 0 1 calc(50% - 6px); | |
} | |
} | |
.dmc-third{ | |
.flex-item{ | |
flex: 0 1 calc(33% - 6px); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is for a 2 or 3 column content layout grid (eg image gallery) but to change the number of columns simply change flex-basis, either with a class or a media query