[SAT] 2021-11-13 TIL

MINBOKยท2021๋…„ 11์›” 13์ผ
0

๋ฉ‹์Ÿ์ด์‚ฌ์ž์ฒ˜๋Ÿผ

๋ชฉ๋ก ๋ณด๊ธฐ
6/19
post-custom-banner

์•„ ์˜จ๋ชธ์ด ์‘ค์‹ ๋‹ค.
์‹ฌ์ง€์–ด ๊ฐˆ๋น„๋ผˆ๋„ ์‘ค์‹ ๋‹ค.
์˜ค๋Š˜์€ ์ ˆ๋Œ€ ์šด๋™๋ชจํƒœ
์ŠคํŠธ๋ ˆ์นญ๋งŒ ํ•˜๊ณ  ์ž์•ผ์ง€๐Ÿ˜Ž

CSS

๐Ÿ”ทFlex (for. Flex-container)

1. Flex?

: display ์†์„ฑ ์ค‘ ํ•˜๋‚˜๋กœ block ์š”์†Œ์˜ ์†์„ฑ์„ ๊ฐ€์ง„๋‹ค.
๋ถ€๋ชจ(Flex-container)์š”์†Œ๊ฐ€ ์ž์‹(Flex-item)์š”์†Œ๋ฅผ ์ปจํŠธ๋กคํ•œ๋‹ค.

1.1 display: flex;

1.2 display: inline-flex;

2.flex-direction

: ๋ฉ”์ธ์ถ•์˜ ๋ฐฉํ–ฅ์„ ์ •ํ•˜๋Š” ์†์„ฑ (๊ฐ€๋กœ / ์„ธ๋กœ)

  • row : ๊ฐ€๋กœ ๋ฐฐ์น˜
  • column : ์„ธ๋กœ ๋ฐฐ์น˜
  • row-reverse : ๊ฐ€๋กœ ์—ญ์ˆœ ๋ฐฐ์น˜
  • column-reverse : ์„ธ๋กœ ์—ญ์ˆœ ๋ฐฐ์น˜

3.flex-wrap

: ์ปจํ…Œ์ด๋„ˆ ๋‚ด๋ถ€์˜ ์•„์ดํ…œ ์ค„๋ฐ”๊ฟˆ ์†์„ฑ

  • nowrap (๊ธฐ๋ณธ๊ฐ’)
    : ์ค„๋ฐ”๊ฟˆ์„ ํ•˜์ง€์•Š์Œ, ์•„์ดํ…œ์ด ์ปจํ…Œ์ด๋„ˆ๋ฅผ ๋ฒ—์–ด๋‚จ
  • wrap : ์ค„๋ฐ”๊ฟˆ์„ ํ•จ
  • wrap-reverse : ์ค„๋ฐ”๊ฟˆ ํ›„ ์•„์ดํ…œ์„ ์—ญ์ˆœ์œผ๋กœ ๋ฐฐ์น˜

4.justify-content

: ๋ฉ”์ธ์ถ• ๋ฐฉํ–ฅ ์•„์ดํ…œ ์ •๋ ฌ

  • flex-start (๊ธฐ๋ณธ๊ฐ’) : ์•„์ดํ…œ์„ ์‹œ์ž‘์ ์œผ๋กœ ์ •๋ ฌ
  • flex-end : ์•„์ดํ…œ์„ ๋์ ์œผ๋กœ ์ •๋ ฌ
  • center : ๊ฐ€์šด๋ฐ ์ •๋ ฌ
  • space-between : ์•„์ดํ…œ ์‚ฌ์ด์— ๋™์ผํ•œ ๊ฐ„๊ฒฉ์„ ๋ถ€์—ฌ
  • space-around : ์•„์ดํ…œ์˜ ์‚ฌ๋ฐฉ์œผ๋กœ ๋™์ผํ•œ ๊ฐ„๊ฒฉ์„ ๋ถ€์—ฌ
  • space-evenly : ์•„์ดํ…œ ์‚ฌ์ด์™€ ์–‘๋์— ๋™์ผํ•œ ๊ฐ„๊ฒฉ์„ ๋ถ€์—ฌ

โœจ์ฐธ๊ณ 
https://www.w3schools.com/cssref/css3_pr_justify-content.asp

5. align-items

: ์ˆ˜์ง์ถ• ๋ฐฉํ–ฅ ์•„์ดํ…œ ์ •๋ ฌ, ๋ฉ”์ธ์ถ• ๊ธฐ์ค€์œผ๋กœ ์ˆ˜์ง ๋ฐฉํ–ฅ

  • stretch (๊ธฐ๋ณธ๊ฐ’) : Items are stretched to fit the container
  • flex-start : ์‹œ์ž‘์  ์ •๋ ฌ
  • flex-end: ๋์  ์ •๋ ฌ
  • center : ๊ฐ€์šด๋ฐ ์ •๋ ฌ
  • baseline : Items are positioned at the baseline of the container

โœจ์ฐธ๊ณ 
https://www.w3schools.com/cssref/css3_pr_align-items.asp

6. align-content

flex-wrap: wrap;์ด ์„ค์ •๋œ ์ƒํƒœ์—์˜ ์ˆ˜์ง์ถ• ๋ฐฉํ–ฅ ์ •๋ ฌ

  • stretch
  • flex-start
  • flex-end
  • center
  • space-between
  • space-around
  • space-evenly

โœจ์ฐธ๊ณ 
https://www.w3schools.com/cssref/css3_pr_align-content.asp

๐Ÿ”ทFlex (for. Flex-item)

1. flex-basis

: flex-item์˜ ํฌ๊ธฐ๋ฅผ ํŠน์ •ํ•จ
(flex-direction์ด row์ผ ๋•Œ๋Š” ๋„ˆ๋น„, column์ผ ๋•Œ๋Š” ๋†’์ด)

  • auto(๊ธฐ๋ณธ๊ฐ’)์˜ ๊ฒฝ์šฐ width, height ๊ฐ’์„ ์‚ฌ์šฉ
  • flex-basis ๊ฐ’ ์ ์šฉ์‹œ, width, height ๊ฐ’์€ ๋ฌด์‹œ

2. flex-grow

: ์•„์ดํ…œ์ด flex-basis์˜ ๊ฐ’๋ณด๋‹ค ์ปค์งˆ ์ˆ˜ ์žˆ๋Š”์ง€๋ฅผ ๊ฒฐ์ •

  • flex-grow: 0; (๊ธฐ๋ณธ๊ฐ’)
  • ์•„์ดํ…œ๋“ค์˜ flex-basis๋ฅผ ์ œ์™ธํ•œ ์—ฌ๋ฐฑ ๋ถ€๋ถ„์„ ๋น„์œจ์— ๋”ฐ๋ผ ๋‚˜๋ˆ„์–ด๊ฐ€์ง

3. flex-shrink

: flex-grow์— ๋ฐ˜๋Œ€๋˜๋Š” ๊ฐœ๋…, ์•„์ดํ…œ์ด flex-basis์˜ ๊ฐ’๋ณด๋‹ค ์ž‘์•„์งˆ ์ˆ˜ ์žˆ๋Š”์ง€๋ฅผ ๊ฒฐ์ •

  • flex-shrink: 1; (๊ธฐ๋ณธ๊ฐ’)
    โ– ๋ณ„๋„์˜ ์„ค์ •์—†์ด๋„
    ์•„์ดํ…œ์ด flex-basis๋ณด๋‹ค ์ž‘์•„์งˆ ์ˆ˜ ์žˆ์Œ
  • flex-shrink: 0; ๊ณผ *width๋กœ ๊ณ ์ •ํฌ๊ธฐ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Œ (flex-basis๋ณด๋‹ค ์ž‘์•„์ง€์ง€์•Š์Œ)
/**flex ์†์„ฑ ์ถ•์•ฝํ•˜๊ธฐ/

.item {
	flex: 1 1 auto;
	/* flex-grow: 1; flex-shrink: 1; 
           flex-basis: auto; */

4. align-self

: ๊ฐœ๋ณ„ ์•„์ดํ…œ์— ๋Œ€ํ•œ ์ˆ˜์ง ์ •๋ ฌ
align-items๋ณด๋‹ค align-self๊ฐ€ ์šฐ์„ ํ•จ

  • auto (๊ธฐ๋ณธ๊ฐ’)
    : ๋ถ€๋ชจ ์š”์†Œ์˜ align-items์„ ์ƒ์†๋ฐ›์Œ

  • stretch

  • flex-start

  • flex-end

  • center

  • baseline

    5. order

    : ์•„์ดํ…œ์˜ ์‹œ๊ฐ์  ์ˆœ์„œ ๋ณ€๊ฒฝ,
    html ๊ตฌ์กฐ๋Š” ๋ณ€๊ฒฝ๋˜์ง€์•Š์Œ

โœจ์ฐธ๊ณ 
1๋ถ„์ฝ”๋”ฉ: https://studiomeal.com/archives/197

Flex ๊ฒŒ์ž„: https://flexboxfroggy.com/#ko

๐Ÿ”ทGrid

๋ฏธ๋ž˜์˜ ๋‚˜๋ฅผ ์œ„ํ•ด ๊ทธ๋ ค๋ด„

โœจ์ฐธ๊ณ 
https://yamoo9.gitbook.io/css-grid/css-grid-term

grid-template-columns : ์—ด์˜ ๋„“์ด ์„ค์ •

grid-template-rows : ํ–‰์˜ ๋†’์ด ์„ค์ •

repeat ๊ทธ๋ฆฌ๋“œ ํŠธ๋ž™ ๋ฐ˜๋ณต ์„ค์ •

# ๊ฐ ์…€์˜ ์œ„์น˜ ์ง€์ •

grid-column-start
grid-column-end
grid-column
grid-row-start
grid-row-end
grid-row

.item {
	grid-column-start: 1;
	grid-column-end: 2;
	grid-column : 1 / span 2 /*์ถ•์•ฝํ˜•*/
}
post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€