Last active
May 25, 2020 22:51
-
-
Save JamesIves/2ccc2c18e51fcd9f1cd15fdcf6ce8d6b to your computer and use it in GitHub Desktop.
Basic CSS grid built with flex which supports a large and small breakpoint.
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
//* Flex Container and Margins | |
.row { | |
box-sizing: border-box; | |
display: flex; | |
flex: 0 1 auto; | |
-ms-flex-direction: row; | |
flex-direction: row; | |
-ms-flex-wrap: wrap; | |
flex-wrap: wrap; | |
margin-right: -1rem; | |
margin-left: -1rem; | |
} | |
//* Extra Small Devices | |
.col-extra-small, | |
.col-extra-small-1, | |
.col-extra-small-2, | |
.col-extra-small-3, | |
.col-extra-small-4, | |
.col-extra-small-5, | |
.col-extra-small-6, | |
.col-extra-small-7, | |
.col-extra-small-8, | |
.col-extra-small-9, | |
.col-extra-small-10, | |
.col-extra-small-11, | |
.col-extra-small-12 { | |
box-sizing: border-box; | |
-ms-flex: 0 0 auto; | |
flex: 0 0 auto; | |
padding-right: 1rem; | |
padding-left: 1rem; | |
} | |
.col-extra-small { | |
-webkit-flex-grow: 1; | |
-ms-flex-positive: 1; | |
flex-grow: 1; | |
-ms-flex-preferred-size: 0; | |
flex-basis: 0; | |
max-width: 100%; | |
} | |
.col-extra-small-1 { | |
-ms-flex-preferred-size: 8.333%; | |
flex-basis: 8.333%; | |
max-width: 8.333%; | |
} | |
.col-extra-small-2 { | |
-ms-flex-preferred-size: 16.667%; | |
flex-basis: 16.667%; | |
max-width: 16.667%; | |
} | |
.col-extra-small-3 { | |
-ms-flex-preferred-size: 25%; | |
flex-basis: 25%; | |
max-width: 25%; | |
} | |
.col-extra-small-4 { | |
-ms-flex-preferred-size: 33.333%; | |
flex-basis: 33.333%; | |
max-width: 33.333%; | |
} | |
.col-extra-small-5 { | |
-ms-flex-preferred-size: 41.667%; | |
flex-basis: 41.667%; | |
max-width: 41.667%; | |
} | |
.col-extra-small-6 { | |
-ms-flex-preferred-size: 50%; | |
flex-basis: 50%; | |
max-width: 50%; | |
} | |
.col-extra-small-7 { | |
-ms-flex-preferred-size: 58.333%; | |
flex-basis: 58.333%; | |
max-width: 58.333%; | |
} | |
.col-extra-small-8 { | |
-ms-flex-preferred-size: 66.667%; | |
flex-basis: 66.667%; | |
max-width: 66.667%; | |
} | |
.col-extra-small-9 { | |
-ms-flex-preferred-size: 75%; | |
flex-basis: 75%; | |
max-width: 75%; | |
} | |
.col-extra-small-10 { | |
-ms-flex-preferred-size: 83.333%; | |
flex-basis: 83.333%; | |
max-width: 83.333%; | |
} | |
.col-extra-small-11 { | |
-ms-flex-preferred-size: 91.667%; | |
flex-basis: 91.667%; | |
max-width: 91.667%; | |
} | |
.col-extra-small-12 { | |
-ms-flex-preferred-size: 100%; | |
flex-basis: 100%; | |
max-width: 100%; | |
} | |
.col-extra-small-offset-1 { | |
margin-left: 8.333%; | |
} | |
.col-extra-small-offset-2 { | |
margin-left: 16.667%; | |
} | |
.col-extra-small-offset-3 { | |
margin-left: 25%; | |
} | |
.col-extra-small-offset-4 { | |
margin-left: 33.333%; | |
} | |
.col-extra-small-offset-5 { | |
margin-left: 41.667%; | |
} | |
.col-extra-small-offset-6 { | |
margin-left: 50%; | |
} | |
.col-extra-small-offset-7 { | |
margin-left: 58.333%; | |
} | |
.col-extra-small-offset-8 { | |
margin-left: 66.667%; | |
} | |
.col-extra-small-offset-9 { | |
margin-left: 75%; | |
} | |
.col-extra-small-offset-10 { | |
margin-left: 83.333%; | |
} | |
.col-extra-small-offset-11 { | |
margin-left: 91.667%; | |
} | |
//* Small Devices | |
@media only screen and (min-width: 48em) { | |
.col-small, | |
.col-small-1, | |
.col-small-2, | |
.col-small-3, | |
.col-small-4, | |
.col-small-5, | |
.col-small-6, | |
.col-small-7, | |
.col-small-8, | |
.col-small-9, | |
.col-small-10, | |
.col-small-11, | |
.col-small-12 { | |
box-sizing: border-box; | |
-ms-flex: 0 0 auto; | |
flex: 0 0 auto; | |
padding-right: 1rem; | |
padding-left: 1rem; | |
} | |
.col-small { | |
-webkit-flex-grow: 1; | |
-ms-flex-positive: 1; | |
flex-grow: 1; | |
-ms-flex-preferred-size: 0; | |
flex-basis: 0; | |
max-width: 100%; | |
} | |
.col-small-1 { | |
-ms-flex-preferred-size: 8.333%; | |
flex-basis: 8.333%; | |
max-width: 8.333%; | |
} | |
.col-small-2 { | |
-ms-flex-preferred-size: 16.667%; | |
flex-basis: 16.667%; | |
max-width: 16.667%; | |
} | |
.col-small-3 { | |
-ms-flex-preferred-size: 25%; | |
flex-basis: 25%; | |
max-width: 25%; | |
} | |
.col-small-4 { | |
-ms-flex-preferred-size: 33.333%; | |
flex-basis: 33.333%; | |
max-width: 33.333%; | |
} | |
.col-small-5 { | |
-ms-flex-preferred-size: 41.667%; | |
flex-basis: 41.667%; | |
max-width: 41.667%; | |
} | |
.col-small-6 { | |
-ms-flex-preferred-size: 50%; | |
flex-basis: 50%; | |
max-width: 50%; | |
} | |
.col-small-7 { | |
-ms-flex-preferred-size: 58.333%; | |
flex-basis: 58.333%; | |
max-width: 58.333%; | |
} | |
.col-small-8 { | |
-ms-flex-preferred-size: 66.667%; | |
flex-basis: 66.667%; | |
max-width: 66.667%; | |
} | |
.col-small-9 { | |
-ms-flex-preferred-size: 75%; | |
flex-basis: 75%; | |
max-width: 75%; | |
} | |
.col-small-10 { | |
-ms-flex-preferred-size: 83.333%; | |
flex-basis: 83.333%; | |
max-width: 83.333%; | |
} | |
.col-small-11 { | |
-ms-flex-preferred-size: 91.667%; | |
flex-basis: 91.667%; | |
max-width: 91.667%; | |
} | |
.col-small-12 { | |
-ms-flex-preferred-size: 100%; | |
flex-basis: 100%; | |
max-width: 100%; | |
} | |
.col-small-offset-1 { | |
margin-left: 8.333%; | |
} | |
.col-small-offset-2 { | |
margin-left: 16.667%; | |
} | |
.col-small-offset-3 { | |
margin-left: 25%; | |
} | |
.col-small-offset-4 { | |
margin-left: 33.333%; | |
} | |
.col-small-offset-5 { | |
margin-left: 41.667%; | |
} | |
.col-small-offset-6 { | |
margin-left: 50%; | |
} | |
.col-small-offset-7 { | |
margin-left: 58.333%; | |
} | |
.col-small-offset-8 { | |
margin-left: 66.667%; | |
} | |
.col-small-offset-9 { | |
margin-left: 75%; | |
} | |
.col-small-offset-10 { | |
margin-left: 83.333%; | |
} | |
.col-small-offset-11 { | |
margin-left: 91.667%; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment