Last active
June 13, 2018 15:10
-
-
Save alukos/1462f9aa7820f4bd1beb694bcfa797b4 to your computer and use it in GitHub Desktop.
css-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
.container { | |
// one line | |
/* | |
auto | |
normal | |
start | |
end | |
center | |
stretch | |
baseline | |
first baseline | |
last baseline | |
*/ | |
justify-items: start; // horizontal align; not stretched, only align, default stretch; | |
align-items: start; // vertical align | |
//for multitrack | |
/* | |
normal | |
start | |
end | |
center | |
stretch | |
space-around | |
space-between | |
space-evenly | |
baseline | |
first baseline | |
last baseline | |
*/ | |
justify-content: start; | |
align-content: start; | |
} | |
.item { | |
/* | |
auto | |
normal | |
start | |
end | |
center | |
stretch | |
baseline | |
first baseline | |
last baseline | |
*/ | |
justify-self: start; | |
align-self: start; // item vertical align | |
} |
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
.container { | |
display: grid; | |
grid-tempalate-areas: | |
'. header header header .' | |
'. left content right .' | |
'footer left footer footer footer'; | |
} | |
.header { | |
grid-area: header; | |
} | |
.left { | |
grid-area: left; | |
} | |
... |
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
.container { | |
display: grid; | |
grid-template-colums: repeat(auto-fill, minmax(150px, 1rf)); // first decrease to min then next row | |
// auto-fill - empty space for virtual items | |
} |
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
.container { | |
display: grid; | |
grid-template-colums: repeat(auto-fit, minmax(150px, 1rf)); // first decrease to min then next row | |
// auto-fit - items max fit line, without empty virtual items | |
} |
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
.container { | |
display: grid; | |
grid-template-colums: minmax(150px, 250px) repeat(2, 1fr 2 fr); | |
grid-auto-rows: minmax(100px, auto); | |
grid-auto-flow: column; // direction | |
grid-template-rows: 160px 160px 160px; | |
} |
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
.item { | |
grid-column: 1 / -1; // whole row | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment