๐Ÿค” ๋งˆ์ง„ ์ƒ์‡„

๋ฐ•์ƒ์€ยท2021๋…„ 10์›” 8์ผ
0

๐Ÿช„ CSS ๐Ÿช„

๋ชฉ๋ก ๋ณด๊ธฐ
4/6
post-thumbnail

๋งˆ์ง„ ์ƒ์‡„๋ž€ ๋งˆ์ง„๋ผ๋ฆฌ ๊ฒน์ณ์„œ ๋” ํฐ ๋งˆ์ง„๋งŒ ๋‚จ๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.

1. ๋ฐœ์ƒ์ƒํ™ฉ

  1. ์ธ์ ‘ ํ˜•์ œ๊ฐ„์˜ ๋ฐ”๊นฅ ๋งˆ์ง„
  2. ๋นˆ ๋ธ”๋ก
  3. ๋ถ€๋ชจ์™€ ์ž์†์„ ๋ถ„๋ฆฌํ•˜๋Š” ์ปจํ…์ธ ๊ฐ€ ์—†์„ ๋•Œ

2. ์˜ˆ์‹œ

  • ์ธ์ ‘ ํ˜•์ œ๊ฐ„์˜ ๋ฐ”๊นฅ ๋งˆ์ง„
<body>
  <div class="first">first</div>
  <div class="second">second</div>
</body>
.first, .second {
  margin: 10px 0;
}
  • ๋ถ€๋ชจ์™€ ์ž์†์„ ๋ถ„๋ฆฌํ•˜๋Š” ์ปจํ…์ธ ๊ฐ€ ์—†์„ ๋•Œ
<body>
  <div class="parent">
    <div class="first__child">first</div>
    <div class="second__child">second</div>
    <div class="last__child">last</div>
  </div>
</body>
div {
  margin: 10px 0;
}

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