컨텐츠를 정렬하거나 공간을 나눌수 있는 CSS속성의 집합
display의 속성이다.
// block, inline-block과 유사
display: flex;
display: inline-flex;
flex-direction: row;
flex-direction: row-reverse;
flex-direction: column;
flex-direction: column-reverse;
justify-content: flex-start;
justify-content: flex-end;
justify-content: center;
justify-content: space-between;
justify-content: space-around;
justify-content: space-evenly;
align-items: stretch; // 기본값
align-items: center;
align-items: flex-start;
align-items: flex-end;
flex-box 구조 한눈에 보기
그 밖의 속성들
display: grid;
컨테이너에 적용하는 속성
1. 그리드 형태 정의
// 열 세개 1fr로 생성
grid-template-columns: 1fr 1fr 1fr;
grid-template-columns: repeat(3, 1fr);
// 행 세개 100px로 생성
grid-template-rows: 100px 100px 100px;
grid-template-rows: repeat(3, 100px);
2. 간격 만들기
row-gap: 10px;
column-gap: 20px;
gap: 10px; // row, column 10px씩
아이템에 적용하는 속성
- 첫번째 칸 2x2 만들기
1. 시작번호 1~3 지정
grid-column-start: 1;
grid-column-end: 3;
grid-row-start: 1;
grid-row-end: 3;
grid-column: 1 / 3;
grid-row: 1 / 3;
2. 몇개의 셀 차지할 것인지 지정
grid-column: 1 / span 2; // 1번 라인에서 2칸
grid-row: 1 / span 2; // 1번 라인에서 2칸
+ 용어