gutters or gaps : 각 행과 열 사이 공백table vs grid
- 형태는 같으나 grid는 레이아웃에 사용
- table은 데이터에 관한 작업을 수행할 때 사용 (table을 레이아웃으로 사욯하면 X)
display
display: inline-grid;grid-template-rows
grid-template-columns
grid-template-columns: 80px 80px 30px;
/* 몇 개의 item이 있든, 한 행에는 3개의 item이 존재
	각 행의 첫 번째는 80px, 두 번째는 70px, 세 번째는 30px*/
grid-template-rows: 100px 20px;
/* 첫 번째 행의 모든 아이템의 높이는 100px, 두 번째 행의 모든 아이템 높이는 20px */Nfr : 컨테이너의 넓이 중 차지하는 비율 (1fr 2fr 👉 1: 2의 비율)repeat(횟수, 크기) 로 작성 가능grid-template-rows: repeat(4, 100px)
/* 4개의 행에 대하여 모두 100px로 설정 */grid-template-areas
.container{
	grid-template-areas: 
		'a a .'
		'a a .'
		'b b b';
	/* . 은 빈 공간 */
}
.itemA{ grid-area: a }
.itemB{ grid-area: b }

row-gap
row-gap: 10px;
/* 각 행 사이가 10px씩 생김 */column-gap
gap
gap: 10px 20px;
/* row column */grid-auto-rows
grid-auto-rows: 100px;grid-auto-columns
grid-auto-flow
grid-auto-flow: column;
/* grid 방향을 세로로 변경
	한 열을 먼저 채운 후, 다음 열로 넘어감 */
grid-auto-flow: row dense;
/* dense: 여백없이 아래서 item을 끌어와 빈 공간을 채움
	item마다 크기를 다르게 지정했을 경우 사용 */grid (shorthand)
/ 를 기준으로 앞 부분은 row, 뒷 부분은 column에 대해 작성grid: 1fr 2fr / 1fr 1fr 1fr;
/* grid-template-rows columns */
grid: auto-flow / 200px;
/* grid-auto-flow template-column */justify-content
flex 의 justify-content와 동일justify-content: flex-start;
/* 주축이 시작되는 위치부터 정렬 - 왼쪽 정렬처럼 보임(주축에 따라 달라지기 때문에 정렬과 같은 값은 아님 !) */
/* justify-content를 설정할 때는, flex-direction을 함께 작성해야 보다 정확한 설정이 됨 */ 
justify-content: flex-end;
/* 주축이 끝나는 위치부터 정렬 - 오른쪽 정렬처럼 보임 */
justify-content: center;
/* 가운데 정렬 */
justify-content: space-between;
/* 화면 크기에 따라 item끼리의 여백이 동일하게 늘어남 */
justify-content: space-around;
/* 화면 크기에 따라 item의 양 옆으로 동일한 여백을 줌 */
/* 간격을 계산할 때, between은 item사이의 여백, around는 item 양 옆에 여백 */
align-content
align-content: start;
/* 교차축의 시작 부분이 맨 위 */
align-content: end;
/* 교차축의 끝 부분이 맨 위 */
align-content: center;
/* 교차축의 가운데 부분이 맨 위 */
align-content: space-between;
/* item 간이 아닌 items 간의 간격이 동일하게 늘어남 */
align-content: space-around;
/* item의 양옆 간격이 아닌 items의 상하 간격이 동일하게 늘어남 */justify-items
justify-items: stretch;
/* 기본값: template에 맞춰서 영역 모두 차지 */
justify-items: start;
/* content영역만큼만 차지하게 됨, 왼쪽 상단에 위치 */
justify-items: end;
/* content영역만큼만 차지하게 됨, 오른쪽 상단에 위치 */
justify-items: center;
/* content영역만큼만 차지하게 됨, 가운데 상단에 위치 */justify-self: start;
/* 특정 item에 대해서만 속성 지정 */align-items
justify-items: stretch;
/* 기본값: template에 맞춰서 영역 모두 차지 */
justify-items: start;
/* content영역만큼만 차지하게 됨, 왼쪽 하단에 위치 */
justify-items: end;
/* content영역만큼만 차지하게 됨, 오른쪽 하단에 위치 */
justify-items: center;
/* content영역만큼만 차지하게 됨, 가운데 하단에 위치 */grid-row
start부터 end 전까지 들어감grid-row: 1 / 4;
/* grid의 1부터 3번 행까지 차지 
	음수로 작성한다면 -1이 맨 마지막 행 */
grid-row: 2 / span 3;
/* 2행부터 3칸 차지 */grid-column
grid-area
/* 1번 */
.container{
	grid-template-areas: 
		'a a .'
		'a a .'
		'b b b';
}
.itemA{ grid-area: a }
.itemB{ grid-area: b }
---
/* 2번 */
.itemC{
	grid-area: row-start / column-start / row-end / column-end;
}
order
z-index
⚠ 속성 X 속성값 O
fr : 비율을 설정해서 나눌 때 사용
절대 길이와 함께 사용 가능(절대 길이를 제외한 나머지의 비율 고려)
min-content : 가장 긴 단어를 기준으로 너비 맞춤
max-content : 최대한 한 줄에 작성할 수 있는 너비 맞춤
auto-fill : 개수를 지정하지 않고, 공간에 맞춰 들어가는 개수가 달라지게 됨
display: grid;
grid-template-columns: repeat(auto-fill, 100px);
grid-auto-rows: 50px;
/* 너비가 100px인 각 item들을 container 크기에 맞춰 배치
	container 크기에 따라 한 행의 열 개수가 달라짐 */
---
display: grid;
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
				/* 100px이 들어갈 수 있다면 추가, 아닐 경우 나머지의 너비를 1fr로 지정 */
grid-auto-rows: 50px;auto-fit : 모든 아이템을 배치하고도 여백이 생길 경우
display: grid;
grid-template-columns: repeat(auto-fit, 100px);
grid-auto-rows: 50px;
/* item을 아래에서 더 끌어올 수 없는 경우, 행의 너비를 꽉 채움(100px 이상으로 늘어남) */⚠ auto-fill vs auto-fit
- 기본적으로는 들어갈 수 있는 크기에 맞춰 유동적으로 개수 조절 가능
- 남는 공간이 생겼을 때
- auto-fill: 공간 비워둠
- auto-fit: 공간 채워서 item늘어남