
| 값 | 설명 |
|---|---|
| grid | 컨테이너 안의 항목을 블록 레벨 요소로 배치 |
| inline-grid | 컨테이너 안의 항목을 인라인 레벨 요소로 배치 |
| 값 | 설명 |
|---|---|
| grid-template-columns | 컨테이너 안에 배치할 칼럼의 크기와 개수 지정 |
| grid-template-rows | 컨테이너 안에 배치할 줄의 크기와 개수 지정 |
grid-template-columns: 200px 200px 200px;
grid-template-rows: 100px;
grid-template-columns: 200px 200px 200px;
grid-template-columns: repeat(3, 200px);
너비가 같은 칼럼 2개 배치
grid-template-columns: 1fr 1fr;
2:1:2로 줄 배치
grid-template-rows: 2fr 1fr 2fr;
줄의 최소 높이 100px, 최대 높이 auto
grid-template-rows: minmax(100px, auto);
| 값 | 설명 |
|---|---|
| grid-column-gap | 칼럼과 칼럼 사이의 간격을 지정 |
| grid-row-gap | 줄과 줄 사이의 간격을 지정 |
| grid-gap | 칼럼과 줄 사이의 간격을 한번에 지정 |

| 종류 | 설명 |
|---|---|
| grid-column-start | 칼럼 시작 라인 번호 지정 |
| grid-column-end | 칼럼 마지막 라인 번호 지정 |
| grid-column | 칼럼 시작 번호와 끝 번호 사이에 /를 넣어 지정 |
| grid-row-start | 줄 시작 라인 번호 지정 |
| grid-row-end | 줄 마지막 라인 번호 지정 |
| grid-row | 줄 시작 번호와 끝 번호 사이에 /를 넣어 지정 |
.box1 {
background-color: pink;
grid-area: box1;
}
.box2 {
background-color: orange;
grid-area: box2;
}
.box3 {
background-color: skyblue;
grid-area: box3;
}
.box4 {
background-color: yellow;
grid-area: box4;
}
.box5 {
background-color: greenyellow;
grid-area: box5;
}
.box6 {
background-color: plum;
grid-area: box6;
}
#parent {
...
grid-template-areas:
/* 한 줄에 들어갈 영역을 따옴표로 묶고 빈칸은 . 찍음 */
'box1 box1 box1'
'box2 box3 box3'
'box2 . box4'
'. box5 .'
'box6 . .'
}
