Grid System
HTML / CSS ๋ฐฐ์น
๋ฐฐ์น ํต์ฌ
: ์ผ์ชฝ ์์ ์์ธ๋ค (๋ฐ์ค๋ชจ๋ธ)
์ด๋ป๊ฒ?
block
inline
๋ฐฐ์น ํ๋ฆ์ ๋ฐ๊พธ๋ ๋ฐฉ๋ฒ
float
position
flex: flexible box
flex
flex
์ด์ ์๋ ๋ฐฐ์น๋ฅผ ์ํด์float
,position
์ง์ ์ ํด์ผํ์
flex ์ฃผ์ ๊ฐ๋
container
item
์ถ
main axis
: ์ฃผ์ถ
flex-direction: row;
์ผ ๋ ๊ฐ๋ก ์ถflex-direction: column;
์ผ ๋ ์ธ๋ก ์ถflex-direction: column-reverse;
์ผ ๋ ๋ฐ์์ ์๋ก ์ฌ๋ผ๊ฐ๋ ์ธ๋ก ์ถflex-direction: row-reverse;
์ผ ๋ ์ค๋ฅธ์ชฝ์์ ์ผ์ชฝ์ผ๋ก ๊ฐ๋ ๊ฐ๋ก ์ถ
cross axis
: ํฌ๋ก์ค์ถ
flex ์ ์ ์
๋ชจ๋ ํญ๋ชฉ๋ค์
main axis (์ฃผ์ถ)
์ ๊ธฐ์ค์ผ๋ก ๋ฐฐ์น๊ฐ ์์๋จ๊ธฐ๋ณธ์
row
๋ง์ฝ,
row-reverse
๋ก ์ง์ ํ๊ฒ ๋๋ฉด, ์ค๋ฅธ์ชฝ ๋๋ถํฐ ๋ฐฐ์น๊ฐ ์์๋จ
๋ชจ๋
item
์ ๊ธฐ๋ณธ์ ์ผ๋ก row๋ฅผ ๊ธฐ์ค์ผ๋ก ๋ฐฐ์น๋จflex-direction
:row
๊ฐ์ผ๋ก ๊ธฐ๋ณธ ์ค์ ๋จ
๋ชจ๋
item
์cross axis
๋ฅผ ๋ชจ๋ ์ฑ์ด๋ค๋์ด๋ฅผ ๋ชจ๋ ์ฑ์ด๋ค
align-items: stretch;
๊ฐ ๊ธฐ๋ณธ๊ฐ์ด๊ธฐ ๋๋ฌธ
๋ชจ๋
item
์ ๋ณธ์ธ์ ๋๋น ํน์ content ์์ญ๋งํผ ๋๋น๋ฅผ ๊ฐ์ง๊ฒ ๋๋ค๊ฒฝ์ฐ์ ๋ฐ๋ผ์, ๋ณธ์ธ์ด ์ง์ ๋ฐ์ ๋๋น๋ณด๋ค ์์ ์ ์๋ค
flex-wrap: nowrap
์ด ๊ธฐ๋ณธ๊ฐ์ด๊ธฐ ๋๋ฌธex) ์ ์ฒด item์ ๋๋น์ ํฉ์ด container์ ๋๋น๋ณด๋ค ์์ ๋ ๋ณด๋ค ์์ ๋
๊ฐ ์์ญ์ content ํฌ๊ธฐ / ๋๋น๋งํผ ์์ญ์ ์ฐจ์งํจ
๋ ์์ ์๋ ์์!
๋ชจ๋ ์์ญ์ cross axis (ํฌ๋ก์ค ์ถ)์ ์ฑ์ฐ๊ณ ์๋ ๋ชจ์ต์

flex ์์ฑ
1. flex-wrap
๊ธฐ๋ณธ ๊ฐ
nowrap
ํ ์ค์์ ๋ฌด์กฐ๊ฑด ๋ด๋๋ค
wrap
๊ฐ๊ฐ์ ๋๋น๋งํผ ๊ฐ์ง๊ฒ ๋๊ณ ์๋ฆฌ๊ฐ ์์ผ๋ฉด ๋ฐ์ผ๋ก ๋ด๋ ค๊ฐ
ํ๋ฌ ๋์น์ง ์๊ฒ ์ค์ ํด์ฃผ๋ ๊ฒ!
wrap-reverse
Items wrap round to additional lines in reverse
2. flex-grow
flex-grow
๋ ๋จ์ ๋๋น๋ฅผ ๊ฐ๊ฐ ๋น์จ๋ก ๋๋ ์ ๊ฐ์ ธ๊ฐ
๊ธฐ๋ณธ๊ฐ
0
3. flex-flow
Shorthand property for
flex-direction
andflex-wrap
๊ธฐ๋ณธ๊ฐ
row wrap
image-20200323132416926 row-reverse nowrap
image-20200323132522691 column wrap-reverse
image-20200323132557885 column wrap
image-20200323132931108
4. justify-content
main ์ถ์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌํ๋ค
๊ธฐ๋ณธ๊ฐ:
flex-start
flex-start
flex-end
center
space-around
space-between
space-evenly
5. align-items
crosss ์ถ์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌํ๋ค
stretch
: ๊ธฐ๋ณธ๊ฐ
flex-start
: ์๋จ ์ ๋ ฌ
flex-end
: ํ๋จ ์ ๋ ฌ
baseline
: items are aligned such as their baselines
center
: ์ค์ ์ ๋ ฌ
image-20200323135424441
6. align-content
Sets the distribution of space between and around content items along a flexbox's cross-axis or a gird's block axis
align-content
has no effect when there is onlyl one line of flex items!
๊ธฐ๋ณธ๊ฐ:
stretch
flex-start
flex-end
center
space-between
space-around
image-20200323135336671
7. order
item์ ์์๋ฅผ ์ ์ํ ์ ์๋ค
๊ธฐ๋ณธ๊ฐ:
0
์์๊ฐ๋ ๊ฐ์ง ์ ์์
8. align-self
item์ ์ง์ align์ ์ง์ ํ ์ ์์
flex๋ margin-top: auto
๊ฐ ๊ฐ๋ฅํ๋ค!
Wrap-up
justify - main ์ถ
align - cross ์ถ
content - ์ฌ๋ฌ์ถ
items - ํ ์ค
self - ๊ฐ๋ณ์์
Last updated
Was this helpful?