: Flexible Box Layout, it simplifies how to position elements.
- flex container & flex items.
- flex container is an element of a flex contain flex items. 즉 flex container의 모든 child element가 flex items.
- flex container의 크기와 위치변화에 따라 flex items도 변함.
flex container에 flex나 inline-flex를 적용했을 때, 디폴트로 모두 child elements(=flex items) 왼쪽으로 설정됨. 이를 바꾸는 속성.
flex-start
, flex-end
, center
, space-around
: 동일한 간격을 두고 위치, 그러나 첫번째와 마지막 element 전 후에 공간 존재. space-between
: 동일한 간격을 두고 위치, 그러나 양 끝에 공간 존재 하지 않음. child elements를 수평이 아니라 수직으로 바꿀수 있는 속성.
this is for aligning elements within a single row.
flex-start
: 모든 elements가 parent container의 top에 위치.flex-end
: 모든 elements가 parent container의 bottom에 위치.center
: 위와 아래의 중간에 위치.baseline
: 각 items의 문자 기준선에 맞춰서 정렬stretch
: (디폴트) parent container에 맞춰 top부터 bottom까지 늘림. 그러나 구체적으로 지정된 height은 늘리지 않음. wrap
: container안의 items들(가로 열에 안맞을때)을 다음 줄로 내림. 즉 줄바꿈을 함. wrap-reverse
:wrap
와 같지만 flex-container에 있는 열의 순서를 반대로 바꿈. nowrap
:(디폴트) 여러 줄로 묶지 않고, 한 줄에 표시 align-items
와 같이 위에서 아래로 수직 정렬을 해줌.flex-start
: 모든 열이 남는 공간 없이 위로 정렬flex-end
: 모든 열이 남는 공간 없이 아래로 정렬 center
: 모든 열이 중간에 정렬space-between
: 모든 열들이 위에서 아래로 동일한 간ㄲ으로 정렬 대신, 첫번째와 마지막 전후 사이로 공간이 없음.space-around
:모든 열들이 위에서 아래로 동일한 간격으로 정렬 대신, 첫번째와 마지막 전후에도 동일한 공간이 생김.stretch
:(디폴트) 만약 최소, 최대 높이가 지정되지 않았다면, 열들은 container를 채우려고 늘어남. row
: (디폴트) 가로정렬, 왼쪽에서 오른쪽row-reverse
: 가로 반대 정렬, 오른쪽에서 왼쪽column
: 세로 정렬 , 위에서 아래column-reverse
: 세로 반대 정렬, 아래에서 위로 참고
- main axis(수평)
justify-content
,flex-wrap
,flex-grow
,flex-shrink
- cross axis(수직)
align-items
,align-content
flex-wrap
,flex-direction
<!-- 이거를 -->
.container {
display: flex;
flex-wrap: wrap;
flex-direction: column;
}
<!-- flex-flow 사용 후-->
.container {
display: flex;
flex-flow: column wrap;
}
display:flex
와는 다름.flex-grow
,flex-shrink
,flex-basis
를 순서대로 한번에 쓸수 있게 해줌.big {
flex: 2 1 150px;
}