ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [CSS] Flex์†์„ฑ
    html.css.js/html css 2023. 8. 7. 21:04

    ๐Ÿ’ก Flex๋ž€ ๋ฌด์—‡์ผ๊นŒ?

    ๋ถ€๋ชจ ์š”์†Œ์ธ div.container๋ฅผ Flex Container๋ผ๊ณ  ๋ถ€๋ฅด๊ณ ,

    ์ž์‹ ์š”์†Œ์ธ div.item๋“ค์„ Flex Item์ด๋ผ๊ณ  ๋ถ€๋ฅธ๋‹ค.

    ์ฆ‰ , ์ปจํ…Œ์ด๋„ˆ๊ฐ€ Flex์˜ ์˜ํ–ฅ์„ ๋ฐ›๋Š” ์ „์ฒด ๊ณต๊ฐ„์ด๊ณ 

    => ๋ถ€๋ชจ ์š”์†Œ ์•ˆ์—์„œ ์ž์‹์š”์†Œ์ธ ์•„์ดํ…œ๋“ค์ด ๋ฐฐ์น˜๋˜๋Š” ๊ฒƒ์ž„.

     

    ์ด๊ฒƒ๋“ค์„ ๋ถ„๋ฆฌํ•ด์„œ ์ ์šฉํ•˜๋Š” ๊ฒƒ์ด ๊ฐ€์žฅ ์ค‘์š”ํ•จ!!

    ๋ถ€๋ชจ ์†์„ฑ(container)

    => flex-direction / flex-wrap / justify-content / align-items / align-content

    ์ž์‹ ์†์„ฑ(item)

    => flex / flex-grow / flex-shrink / flex- basis / order

     

    Flex Container์— ์ ์šฉํ•˜๋Š” ์†์„ฑ๋“ค

    ์ผ๋‹จ display : flex๋ฅผ ์ ์šฉํ•˜์ž.!

    ๊ทธ๋Ÿฌ๋ฉด ์ด๋ ‡๊ฒŒ ๊ฐ€๋กœ ๋ฐฉํ–ฅ์œผ๋กœ ๋ฐฐ์น˜๋˜๊ณ ,

    ์ž์‹ ์ด ๊ฐ€์ง„ ๋‚ด์šฉ๋ฌผ์˜ width๋งŒํผ๋งŒ ์ฐจ์ง€ํ•˜๊ฒŒ ๋จ! ( = inline์†์„ฑ๊ณผ ๊ฐ™์Œ)

    height๋Š” ์ปจํ…Œ์ด๋„ˆ์˜ ๋†’์ด๋งŒํผ ๋Š˜์–ด๋‚จ!

    (inline-flex ๋Š” inline-block์†์„ฑ๊ณผ ๊ฐ™์Œ)

     

    Flex-direction : ์•„์ดํ…œ๋“ค์ด ๋ฐฐ์น˜๋˜๋Š” ์ถ•์˜ ๋ฐฉํ–ฅ ๊ฒฐ์ • (๊ฐ€๋กœ ์ •๋ ฌ OR ์„ธ๋กœ ์ •๋ ฌ)

    row ํ–‰(๊ฐ€๋กœ) ๋ฐฉํ–ฅ์œผ๋กœ ๋ฐฐ์น˜
    row-reverse ํ–‰(๊ฐ€๋กœ) ์—ญ๋ฐฉํ–ฅ์œผ๋กœ ๋ฐฐ์น˜
    column ์—ด(์„ธ๋กœ) ๋ฐฉํ–ฅ์œผ๋กœ ๋ฐฐ์น˜
    column-reverse ์—ด(์„ธ๋กœ) ์—ญ๋ฐฉํ–ฅ์œผ๋กœ ๋ฐฐ์น˜

    Flex-wrap : ์ค„๋ฐ”๊ฟˆ ์†์„ฑ

    => ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ๋”์ด์ƒ ์•„์ดํ…œ์„ ํ•œ ์ค„์— ๋‹ด์„ ์—ฌ์œ  ๊ณต๊ฐ„์ด ์—†์„ ๋•Œ

    nowrap : ์ค„๋ฐ”๊ฟˆ ์—†์Œ

    wrap : ์ค„๋ฐ”๊ฟˆ ํ•จ

    wrap-reverse : ์ค„๋ฐ”๊ฟˆํ•˜๋Š”๋ฐ ์•„์ดํ…œ์„ ์—ญ์œผ๋กœ ๋ฐฐ์น˜ํ•จ!

     

    Flex-flow 

    => flex-direction๊ณผ flex-wrap์„ ํ•œ๊บผ๋ฒˆ์— ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋Š” ๋‹จ์ถ• ์†์„ฑ!

    ์œ„์˜ ์ฝ”๋“œ๋ฅผ ์ค„์—ฌ์„œ ์•„๋ž˜์™€ ๊ฐ™์ด ํ•ฉ์นœ ๊ฒƒ!

    justify-content : ๊ฐ€๋กœ ์ •๋ ฌ

    flex-start : ์•„์ดํ…œ๋“ค์„ ์‹œ์ž‘์ ์œผ๋กœ ์ •๋ ฌ

    align-items : ์„ธ๋กœ ์ •๋ ฌ 

    stretch : ์„ธ๋กœ๋กœ ์ญ‰ ๋Š˜์–ด๋‚จ

    align-content : ์—ฌ๋Ÿฌ ํ–‰ ์ •๋ ฌ

    => flex-wrap : wrap (์ค„๋ฐ”๊ฟˆ)์„ ํ•œ ์ƒํƒœ์—์„œ ์„ธ๋กœ์ •๋ ฌ์„ ํ•  ์ˆ˜ ์žˆ๋‹ค!!

    <์‚ฌ์šฉํ•œ ์ƒ‰์ƒ๋“ค>

    ์ง€๊ธˆ๊นŒ์ง€๋Š” flex.container์— ์ ์šฉ๋˜๋Š” ์†์„ฑ๋“ค์„ ์•Œ์•„๋ณด์•˜๋‹ค.

    ๋‹ค์Œ์‹œ๊ฐ„์—๋Š” flex.item์— ์ ์šฉ๋˜๋Š” ์†์„ฑ๋“ค์„ ์•Œ์•„๋ณด์ž.

    'html.css.js > html css' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

    ๊ทธ๋ฆฌ๋“œ [grid]  (0) 2023.12.15
    web๋™์ž‘์›๋ฆฌ  (2) 2023.11.15
    scss  (0) 2023.11.09
Designed by Tistory.