Created
June 22, 2020 09:32
-
-
Save IvanofSA/239f9b2f2428477906c36510fc0f741c to your computer and use it in GitHub Desktop.
mixins grid
This file contains 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
@mixin grid() { | |
display: flex; | |
flex-wrap: wrap; | |
@supports (grid-area: auto) { | |
display: grid; | |
grid-gap: 16px 16px; | |
} | |
} | |
@mixin gridAuto() { | |
margin-left: -16px; | |
> * { | |
margin-bottom: 16px; | |
margin-left: 16px; | |
} | |
@media (min-width: 320px) { | |
> * { | |
width: calc((99% / #{2}) - 16px); | |
flex: 0 0 calc((99% / #{2}) - 16px); | |
} | |
} | |
@media (min-width: 768px) { | |
> * { | |
width: calc((99% / #{3}) - 16px); | |
flex: 0 0 calc((99% / #{3}) - 16px); | |
} | |
} | |
@supports (grid-area: auto) { | |
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); | |
margin-left: 0; | |
> * { | |
width: auto; | |
margin-left: 0; | |
margin-bottom: 0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment