[CSS] ๐ŸธFlexbox Froggy

2565 ๋‹จ์–ด CSSfroggyFlexboxhtmlCSS

๊ท€์—ฌ์šด ๐Ÿธ๊ฐœ๊ตฌ๋ฆฌ ๊ฒŒ์ž„ flexbox froggy๐Ÿธ๋กœ FLEXBOX๋ฅผ ๊ณต๋ถ€ํ•ด๋ณด์•˜๋‹ค.

์—˜๋ฆฌ๋‹˜์˜ ๋“œ๋ฆผ์ฝ”๋”ฉ ๊ฐ•์˜๋ฅผ ๋“ค์œผ๋ฉด์„œ ํ•˜๊ฒŒ ๋๋Š”๋ฐ ์ •๋ง ์œ ์ตํ•˜๋‹ค! ์‚ฌ๋ž‘ํ•ด์š” ์—˜๋ฆฌ๋‹˜.

โ— ์ฐธ๊ณ  ๋‚ด๊ฐ€ ๋ณด๋ ค๊ณ  ํ•˜๋Š” ์ •๋ฆฌ

๐Ÿงบ justify-content

์š”์†Œ๋ฅผ ๊ฐ€๋กœ ์„ ์ƒ์—์„œ ์ •๋ ฌํ•œ๋‹ค.

flex-end: ์š”์†Œ๋“ค์„ ์ปจํ…Œ์ด๋„ˆ์˜ ์˜ค๋ฅธ์ชฝ์œผ๋กœ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
center: ์š”์†Œ๋“ค์„ ์ปจํ…Œ์ด๋„ˆ์˜ ๊ฐ€์šด๋ฐ๋กœ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
space-between: ์š”์†Œ๋“ค ์‚ฌ์ด์— ๋™์ผํ•œ ๊ฐ„๊ฒฉ์„ ๋‘ก๋‹ˆ๋‹ค.
space-around: ์š”์†Œ๋“ค ์ฃผ์œ„์— ๋™์ผํ•œ ๊ฐ„๊ฒฉ์„ ๋‘ก๋‹ˆ๋‹ค.

๐Ÿงบ align items

์š”์†Œ๋ฅผ ์„ธ๋กœ ์„ ์ƒ์—์„œ ์ •๋ ฌํ•œ๋‹ค.

flex-start: ์š”์†Œ๋“ค์„ ์ปจํ…Œ์ด๋„ˆ์˜ ๊ผญ๋Œ€๊ธฐ๋กœ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
flex-end: ์š”์†Œ๋“ค์„ ์ปจํ…Œ์ด๋„ˆ์˜ ๋ฐ”๋‹ฅ์œผ๋กœ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
center: ์š”์†Œ๋“ค์„ ์ปจํ…Œ์ด๋„ˆ์˜ ์„ธ๋กœ์„  ์ƒ์˜ ๊ฐ€์šด๋ฐ๋กœ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
baseline: ์š”์†Œ๋“ค์„ ์ปจํ…Œ์ด๋„ˆ์˜ ์‹œ์ž‘ ์œ„์น˜์— ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
stretch: ์š”์†Œ๋“ค์„ ์ปจํ…Œ์ด๋„ˆ์— ๋งž๋„๋ก ๋Š˜๋ฆฝ๋‹ˆ๋‹ค.

๐Ÿงบ flex-direction

์ •๋ ฌํ•  ๋ฐฉํ–ฅ์„ ์ง€์ •ํ•œ๋‹ค.
โ— Flex์˜ ๋ฐฉํ–ฅ์ด column์ผ ๊ฒฝ์šฐ justify-content์˜ ๋ฐฉํ–ฅ์ด ์„ธ๋กœ๋กœ, align-items์˜ ๋ฑกํ–ฅ์ด ๊ฐ€๋กœ๋กœ ๋ฐ”๋€๋‹ˆ๋‹ค.

row: ์š”์†Œ๋“ค์„ ํ…์ŠคํŠธ์˜ ๋ฐฉํ–ฅ๊ณผ ๋™์ผํ•˜๊ฒŒ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
row-reverse: ์š”์†Œ๋“ค์„ ํ…์ŠคํŠธ์˜ ๋ฐ˜๋Œ€ ๋ฐฉํ–ฅ์œผ๋กœ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
column: ์š”์†Œ๋“ค์„ ์œ„์—์„œ ์•„๋ž˜๋กœ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
column-reverse: ์š”์†Œ๋“ค์„ ์•„๋ž˜์—์„œ ์œ„๋กœ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ‘” order

flex ์š”์†Œ์˜ ์ˆœ์„œ๋ฅผ ์ง€์ •ํ•œ๋‹ค.

order: n (์ •์ˆ˜ ๋ชจ๋‘ ๊ฐ€๋Šฅ)

๐Ÿ‘” align-self

์ง€์ •๋œ align-items ๊ฐ’์„ ๋ฌด์‹œํ•˜๊ณ  flex ์š”์†Œ๋ฅผ ์„ธ๋กœ์„  ์ƒ์—์„œ ์ •๋ ฌํ•œ๋‹ค.

flex-start: ์š”์†Œ๋“ค์„ ์ปจํ…Œ์ด๋„ˆ์˜ ๊ผญ๋Œ€๊ธฐ๋กœ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
flex-end: ์š”์†Œ๋“ค์„ ์ปจํ…Œ์ด๋„ˆ์˜ ๋ฐ”๋‹ฅ์œผ๋กœ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
center: ์š”์†Œ๋“ค์„ ์ปจํ…Œ์ด๋„ˆ์˜ ์„ธ๋กœ์„  ์ƒ์˜ ๊ฐ€์šด๋ฐ๋กœ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
baseline: ์š”์†Œ๋“ค์„ ์ปจํ…Œ์ด๋„ˆ์˜ ์‹œ์ž‘ ์œ„์น˜์— ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
stretch: ์š”์†Œ๋“ค์„ ์ปจํ…Œ์ด๋„ˆ์— ๋งž๋„๋ก ๋Š˜๋ฆฝ๋‹ˆ๋‹ค.

๐Ÿงบ flex-wrap

flex์š”์†Œ๋“ค์„ ํ•œ ์ค„ ๋˜๋Š” ์—ฌ๋Ÿฌ ์ค„์— ๊ฑธ์ณ ์ •๋ ฌํ•œ๋‹ค.

nowrap: ๋ชจ๋“  ์š”์†Œ๋“ค์„ ํ•œ ์ค„์— ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
wrap: ์š”์†Œ๋“ค์„ ์—ฌ๋Ÿฌ ์ค„์— ๊ฑธ์ณ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
wrap-reverse: ์š”์†Œ๋“ค์„ ์—ฌ๋Ÿฌ ์ค„์— ๊ฑธ์ณ ๋ฐ˜๋Œ€๋กœ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.

๐Ÿงบ flex-flow

flex-direction, flex-wrap์„ ํ•œ ๋ฒˆ์— ์“ด๋‹ค.

flex-flow: wrap column;

๐Ÿงบ align-content

์„ธ๋กœ์„  ์ƒ์˜ ์—ฌ๋ถ„์˜ ๊ณต๊ฐ„์ด ์žˆ๋Š” ๊ฒฝ์šฐ flex container ์‚ฌ์ด์˜ ๊ฐ„๊ฒฉ์„ ์กฐ์ ˆํ•ฉ๋‹ˆ๋‹ค.

flex-start: ์—ฌ๋Ÿฌ ์ค„๋“ค์„ ์ปจํ…Œ์ด๋„ˆ์˜ ๊ผญ๋Œ€๊ธฐ์— ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
flex-end: ์—ฌ๋Ÿฌ ์ค„๋“ค์„ ์ปจํ…Œ์ด๋„ˆ์˜ ๋ฐ”๋‹ฅ์— ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
center: ์—ฌ๋Ÿฌ ์ค„๋“ค์„ ์„ธ๋กœ์„  ์ƒ์˜ ๊ฐ€์šด๋ฐ์— ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
space-between: ์—ฌ๋Ÿฌ ์ค„๋“ค ์‚ฌ์ด์— ๋™์ผํ•œ ๊ฐ„๊ฒฉ์„ ๋‘ก๋‹ˆ๋‹ค.
space-around: ์—ฌ๋Ÿฌ ์ค„๋“ค ์ฃผ์œ„์— ๋™์ผํ•œ ๊ฐ„๊ฒฉ์„ ๋‘ก๋‹ˆ๋‹ค.
stretch: ์—ฌ๋Ÿฌ ์ค„๋“ค์„ ์ปจํ…Œ์ด๋„ˆ์— ๋งž๋„๋ก ๋Š˜๋ฆฝ๋‹ˆ๋‹ค.

align-items๋Š” ์ปจํ…Œ์ด๋„ˆ ์•ˆ์—์„œ ์–ด๋–ป๊ฒŒ ๋ชจ๋“  ์š”์†Œ๋“ค์ด ์ •๋ ฌํ•˜๋Š”์ง€๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ๋งŒ์•ฝ ์š”์†Œ๊ฐ€ ํ•œ ์ค„๋งŒ ์žˆ๋Š” ๊ฒฝ์šฐ, align-content๋Š” ํšจ๊ณผ๋ฅผ ๋ณด์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

(+) 24๋ฒˆ

flex-flow: wrap-reverse column-reverse;
align-content: space-between;
justify-content: center;

๐Ÿ†

์ข‹์€ ์›นํŽ˜์ด์ง€ ์ฆ๊ฒจ์ฐพ๊ธฐ