CSS | display grid

์•™๋‘ยท2023๋…„ 1์›” 3์ผ
0

CSS

๋ชฉ๋ก ๋ณด๊ธฐ
3/4
post-custom-banner

Grid Properties ? ๐Ÿง

CSS Grid๋Š” CSS Flex์™€ ๊ฐ™์ด Container(์ปจํ…Œ์ด๋„ˆ)์™€ Item(์•„์ดํ…œ)์ด๋ผ๋Š” ๋‘ ๊ฐ€์ง€ ๊ฐœ๋…์œผ๋กœ ๊ตฌ๋ถ„!
Container๋Š” Items๋ฅผ ๊ฐ์‹ธ๋Š” ๋ถ€๋ชจ ์š”์†Œ์ด๋ฉฐ, ๊ทธ ์•ˆ์—์„œ ๊ฐ Item์„ ๋ฐฐ์น˜ํ•  ์ˆ˜ ์žˆ๋‹ค.

Grid Container Properties

display: grid ๋Š” ๊ทธ๋ฆฌ๋“œ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ •์˜ํ•˜๋ฏ€๋กœ ์ตœ์ƒ์œ„ ๋ถ€๋ชจ ํƒœ๊ทธ์— ์ ์šฉ์‹œํ‚จ๋‹ค.

์†์„ฑ ์˜๋ฏธ
grid-template-row ํ–‰(Track)์˜ ํฌ๊ธฐ๋ฅผ ์ •์˜(์•„์ดํ…œ์˜ ๋†’์ด)๋Œ€๋กœ ์ •๋ ฌ
grid-template-columns ์—ด(Track)์˜ ํฌ๊ธฐ๋ฅผ ์ •์˜(์•„์ดํ…œ์˜ ๋„ˆ๋น„)๋Œ€๋กœ ์ •๋ ฌ
row-gap(grid-row-gap) ํ–‰๊ณผ ํ–‰ ์‚ฌ์ด์˜ ๊ฐ„๊ฒฉ์„ ์ •์˜
column-gap(grid-column-gap) ์—ด๊ณผ ์—ด ์‚ฌ์ด์˜ ๊ฐ„๊ฒฉ์„ ์ •์˜
align-content ๊ทธ๋ฆฌ๋“œ ์ฝ˜ํ…์ธ ๋ฅผ ์ˆ˜์ง ์ •๋ ฌ
justify-content ๊ทธ๋ฆฌ๋“œ ์ฝ˜ํ…์ธ ๋ฅผ ์ˆ˜ํ‰ ์ •๋ ฌ
align-items ๊ทธ๋ฆฌ๋“œ ์•„์ดํ…œ๋“ค์„ ์ˆ˜์ง ์ •๋ ฌ
justify-items ๊ทธ๋ฆฌ๋“œ ์•„์ดํ…œ๋“ค์„ ์ˆ˜ํ‰ ์ •๋ ฌ


grid-template-row

display: grid;
grid-template-rows: repeat(4, 100px);
  • repeat์„ ์‚ฌ์šฉํ•˜์—ฌ 4๊ฐœ๊นŒ์ง€ ํ–‰ ๋†’์ด๋ฅผ 100px๋กœ ์ •์˜ํ–ˆ์„ ๊ฒฝ์šฐ


grid-template-columns

display: grid;
grid-template-columns: repeat(3
, 150px);
  • repeat์„ ์‚ฌ์šฉํ•˜์—ฌ 3๊ฐœ ์—ด ๋„ˆ๋น„๋ฅผ 150px๋กœ ์ •์˜ํ–ˆ์„ ๊ฒฝ์šฐ

profile
์“ธ๋ชจ์žˆ๋Š” ๊ธฐ์ˆ ์ž
post-custom-banner

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