inline-grid
: 바깥 container끼리는 inline으로 설정하고, 내부 요소들은 grid를 적용하겠다는 의미 grid-template-rows: 100px 100px
grid-template-columns: 100px 50px 100px
grid-template-rows: 1fr 2fr
-> 1대 2비율로 나눌 수 있음.grid-area: name
-hmtl-
<body>
<div class="parent">Parent
<div class="child1">child1</div>
<div class="child2">child2</div>
</div>
<div class="container">
<div class="item header">
header
</div>
<div class="item main">
main
</div>
<div class="item sidebar">
sidebar
</div>
<div class="item footer">
footer
</div>
</div>
</body>
-css-
.container {
border: 5px dashed orange;
width: 400px;
height: 400px;
display: grid;
/* grid-template-columns: 5fr 3fr 2fr 5fr;
grid-template-rows: repeat(4, 1fr); */
grid-template-areas:
"hd hd hd hd hd"
"hd hd hd hd hd"
"ma ma ma sb sb"
"ft ft ft ft ft"
}
.item {
background-color: paleturquoise;
border: 3px solid blue;
font-size: 24px;
}
.header {
grid-area: hd; -> hd라는 이름으로 area를 차지하자.
}
.main {
grid-area: ma;
}
.sidebar {
grid-area: sb;
}
.footer {
grid-area: ft;
}
row-gap: 20px / column-gap: 50px
gap: 20px 50px;
grid-auto-rows: 100px
grid-auto-flow: column;/row;
grid-auto-flow: row dense/column dense
* <'grid-template'> values */
grid: "a" 100px "b" 1fr;
grid: "a" 200px "b" min-content;
grid: "a" minmax(100px, max-content) "b" 20%;
grid: 100px / 200px;
grid: minmax(400px, min-content) / repeat(auto-fill, 50px);
/* <'grid-template-rows'> /
[ auto-flow && dense? ] <'grid-auto-columns'>? values */
grid: 200px / auto-flow;
grid: 30% / auto-flow dense;
grid: repeat(3, [line1 line2 line3] 200px) / auto-flow 300px;
grid: [line1] minmax(20em, max-content) / auto-flow dense 40%;
/* [ auto-flow && dense? ] <'grid-auto-rows'>? /
<'grid-template-columns'> values */
grid: auto-flow 300px / repeat(3, [line1 line2 line3] 200px);(20em, max-content);
grid-row-start: 1;
grid-row-end:4/-1모두 4칸인 경우 전부 다 차지함.
grid-row: 1/3;
grid-area: a;
grid-area: 2 / 1 / 2 / 4; row-start / col-start / row-end /col-end
grid-template-columns: repeat(auto-fill, 100px);
grid-auto-rows: 50px;
-> 아무리 작아도 min의 값은 유지하도록 하고, min보다 커지면 max의 값을 가져라.