๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

โœ๏ธ/CSS

[CSS] flex

๐Ÿ”— CSS์—์„œ flex๋ž€?

 

 

 box์™€ item ๋“ฑ์„ ํ–‰ ๋˜๋Š” ์—ด๋กœ ์ž์œ ์ž์žฌ๋กœ ๋ฐฐ์น˜์‹œํ‚ฌ ์ˆ˜ ์žˆ๋Š” CSS ์†์„ฑ์ด๋‹ค.

 


 

display: flex;

 

flex-direction : ์ฃผ์ถ• ๋ฐฉํ–ฅ ์„ค์ •

· row : ๊ฐ€๋กœ์ถ•  default

· row-reverse : ๊ฐ€๋กœ์ถ•(์—ญ๋ฐฉํ–ฅ)

· column : ์„ธ๋กœ์ถ•

· column-reverse : ์„ธ๋กœ์ถ•(์—ญ๋ฐฉํ–ฅ)

 

flex-wrap : ์ค„๋ฐ”๊ฟˆ ์„ค์ •

· nowrap : ์ค„๋ฐ”๊ฟˆ X (1ํ–‰์— ๋ชจ๋‘ ๋ฐฐ์น˜ => item width ์ž๋™์œผ๋กœ ์ถ•์†Œ๋จ)  default

· wrap : ์ค„๋ฐ”๊ฟˆ O

· wrap-reverse : ์ค„๋ฐ”๊ฟˆ O (์—ญ๋ฐฉํ–ฅ)

 

โ–ช flex shorthand

flew-flow: flex-direction flex-wrap;


justify-content : ์ฃผ์ถ•(main-axis) ์ •๋ ฌ ์„ค์ • => ๋‘ ์ค„ ์ด์ƒ ๊ธฐ์ค€

· flex-start : ์‹œ์ž‘์  ์ •๋ ฌ  default

· flex-end : ๋์  ์ •๋ ฌ

· center : ๊ฐ€์šด๋ฐ ์ •๋ ฌ

· space-between : ์‹œ์ž‘์  ์ •๋ ฌ / ๋™์ผ ๊ฐ„๊ฒฉ ์ •๋ ฌ / ๋์  ์ •๋ ฌ

· space-around : ๋™์ผ ๊ฐ„๊ฒฉ ์ •๋ ฌ (๊ธฐ์ค€ X)

· space-evenly : ๋™์ผ ๊ฐ„๊ฒฉ ์ •๋ ฌ

 

justify-items : ์ฃผ์ถ•(main-axis) ์ •๋ ฌ ์„ค์ • => items(ํ•œ ์ค„) ๊ธฐ์ค€

· flex-start : ์‹œ์ž‘์  ์ •๋ ฌ  default

· flex-end : ๋์  ์ •๋ ฌ

· center : ๊ฐ€์šด๋ฐ ์ •๋ ฌ

 

align-content : ๊ต์ฐจ์ถ•(cross-axis) ์ •๋ ฌ ์„ค์ • => ๋‘ ์ค„ ์ด์ƒ ๊ธฐ์ค€

· stretch : ๋†’์ด๋ฅผ ์‹œ์ž‘์  ~ ๋์ ์œผ๋กœ ๋Š˜๋ฆผ  default

· flex-start : ์‹œ์ž‘์  ์ •๋ ฌ

· flex-end : ๋์  ์ •๋ ฌ

· center : ๊ฐ€์šด๋ฐ ์ •๋ ฌ

· space-between : ์‹œ์ž‘์  ์ •๋ ฌ / ๋™์ผ ๊ฐ„๊ฒฉ ์ •๋ ฌ / ๋์  ์ •๋ ฌ

· space-around : ๋™์ผ ๊ฐ„๊ฒฉ ์ •๋ ฌ (๊ธฐ์ค€ X)

 

align-items : ๊ต์ฐจ์ถ•(cross-axis) ์ •๋ ฌ ์„ค์ • => items(ํ•œ ์ค„) ๊ธฐ์ค€

· stretch : ๋†’์ด๋ฅผ ์‹œ์ž‘์  ~ ๋์ ์œผ๋กœ ๋Š˜๋ฆผ  default

· flex-start : ์‹œ์ž‘์  ์ •๋ ฌ

· flex-end : ๋์  ์ •๋ ฌ

· center : ๊ฐ€์šด๋ฐ ์ •๋ ฌ


order : ์šฐ์„  ์ˆœ์œ„ ์„ค์ • (์ž‘์„์ˆ˜๋ก ์šฐ์„  ์ˆœ์œ„ default : 1


flex-grow : item ํ™•์žฅ๋น„ ์„ค์ •  default : 0

flex-shrink : item ์ˆ˜์ถ•๋น„ ์„ค์ • default : 1

flex-basis : item ๋„ˆ๋น„ ์„ค์ •  default : auto

 

โ–ช flex shorthand

flex: flex-grow flex-shrink flex-basis;

 

 


๐Ÿ’ก ๊ฐ™์ด ๋ณด๋ฉด ์ข‹์„ Post

 

[CSS] ์™•์ดˆ๋ณด๋ฅผ ์œ„ํ•œ font / background / border ์†์„ฑ ์ •๋ฆฌ

css์—์„œ ์†์„ฑ์€ '์‹œ๊ณ„ ๋ฐฉํ–ฅ'์œผ๋กœ ์ ์šฉ 4๊ฐœ์ผ ๋•Œ : top right bottom left 2๊ฐœ์ผ ๋•Œ : x์ถ•(top, bottom) y์ถ•(left, right) 1๊ฐœ์ผ ๋•Œ : all ๐Ÿ”— Font color : ํ…์ŠคํŠธ ์ƒ‰์ƒ font-size : ํ…์ŠคํŠธ ์‚ฌ์ด์ฆˆ default : 16px..

devjindev.tistory.com

'โœ๏ธ > CSS' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[CSS] animation  (0) 2020.12.19
[CSS] transition  (0) 2020.12.13
[CSS] ์„ ํƒ์ž(selector) ์ •๋ฆฌ  (0) 2020.12.13
[CSS] link (hover, active, visited, link)  (0) 2020.12.12
[CSS] display (inline, inline-block, block) / ์ฐจ์ด์   (0) 2020.12.12