Skip to content

Instantly share code, notes, and snippets.

@vitaliy-kravchenko-dev
Last active January 20, 2018 13:53
Show Gist options
  • Save vitaliy-kravchenko-dev/98a757d8330e534e6c01674ecea391c4 to your computer and use it in GitHub Desktop.
Save vitaliy-kravchenko-dev/98a757d8330e534e6c01674ecea391c4 to your computer and use it in GitHub Desktop.
Flex grid mixin
@mixin flex-grid-items($cols) {
display: flex;
flex-wrap: wrap;
> * {
$item-width: 100% / $cols;
width: $item-width;
box-sizing: border-box;
}
}
/////////////////////////////////////////
.flex-2-cols {
@include flex-grid-items(2)
}
.flex-5-cols {
@include flex-grid-items(5)
}
.flex-9-cols {
@include flex-grid-items(9)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment