Background

1. ๊ฐœ์š”

Background ๊ด€๋ จ ํ”„๋กœํผํ‹ฐ๋Š” ํ•ด๋‹น ์š”์†Œ์˜ ๋ฐฐ๊ฒฝ์œผ๋กœ ์ด๋ฏธ์ง€ ๋˜๋Š” ์ƒ‰์ƒ์„ ์ •์˜ํ•œ๋‹ค. ์›น ๋ฌธ์„œ์˜ ์ „์ฒด ๋ฐฐ๊ฒฝ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ํ…์ŠคํŠธ, ๋ชฉ๋ก ๋“ฑ ํŠน์ •ํ•œ ์š”์†Œ์—๋„ ๋ฐฐ๊ฒฝ์„ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.


2. background-image ํ”„๋กœํผํ‹ฐ

์š”์†Œ์— ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€๋ฅผ ์ง€์ •ํ•œ๋‹ค.

๊ธฐ๋ณธํ˜• background-color: url("์ด๋ฏธ์ง€ ํŒŒ์ผ ๊ฒฝ๋กœ")

<!DOCTYPE html>
<html lang="en">
  <head>
    <style>
      div {
        height: 100vh;
        background-image: url("https://raw.githubusercontent.com/iteach12/html_css_js_basic/1c84313da723024e72882618d203e5f9acab045b/images/logo.png");
      }
    </style>
  </head>
  <body>
    <div>Background-image</div>
  </body>
</html>

3. background-repeat ํ”„๋กœํผํ‹ฐ

๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€์˜ ๋ฐ˜๋ณต์„ ์ง€์ •ํ•œ๋‹ค. ์ˆ˜์ง, ์ˆ˜ํ‰ ๋˜๋Š” ์ˆ˜์ง๊ณผ ์ˆ˜ํ‰ ๋ชจ๋‘์˜ ๋ฐ˜๋ณต์„ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

์ข…๋ฅ˜
์„ค๋ช…

repeat

๋ธŒ๋ผ์šฐ์ € ํ™”๋ฉด์— ๊ฐ€๋“ ์ฐฐ ๋•Œ๊นŒ์ง€ ๊ฐ€๋กœ์™€ ์„ธ๋กœ๋กœ ๋ฐ˜๋ณตํ•œ๋‹ค. ๊ธฐ๋ณธ๊ฐ’

repeat-x

๋ธŒ๋ผ์šฐ์ € ํ™”๋ฉด ๋„ˆ๋น„์— ๊ฐ€๋“ ์ฐฐ ๋•Œ๊นŒ์ง€ ๊ฐ€๋กœ๋กœ ๋ฐ˜๋ณตํ•œ๋‹ค.

repeat-y

๋ธŒ๋ผ์šฐ์ € ํ™”๋ฉด ๋†’์ด์— ๊ฐ€๋“ ์ฐฐ ๋•Œ๊นŒ์ง€ ์„ธ๋กœ๋กœ ๋ฐ˜๋ณตํ•œ๋‹ค.

no-repeat

ํ•œ ๋ฒˆ๋งŒ ํ‘œ์‹œํ•˜๊ณ  ๋ฐ˜๋ณตํ•˜์ง€ ์•Š๋Š”๋‹ค.

<!DOCTYPE html>
<html lang="en">
  <head>
    <style>
      div {
        height: 100vh;
        background-image: url("http://poiemaweb.com/img/bg/dot.png");

        /* ๊ธฐ๋ณธ๊ฐ’ */
        background-repeat: repeat;
      }
    </style>
  </head>
  <body>
    <div>Background-image</div>
  </body>
</html>

๋ฐ˜๋ณต ์ถœ๋ ฅ์„ ๋ฉˆ์ถ”๊ณ  ์‹ถ์€ ๊ฒฝ์šฐ, background-repeat ํ”„๋กœํผํ‹ฐ๊ฐ’์— no-repeat๋ฅผ ์„ค์ •ํ•œ๋‹ค.

<!DOCTYPE html>
<html lang="en">
  <head>
    <style>
      div {
        height: 100vh;
        background-image: url("http://poiemaweb.com/img/bg/dot.png");
        background-repeat: no-repeat;
      }
    </style>
  </head>
  <body>
    <div>Background-image</div>
  </body>
</html>

background-image์— ๋ณต์ˆ˜๊ฐœ์˜ ์ด๋ฏธ์ง€๋ฅผ ์„ค์ •ํ•  ๊ฒฝ์šฐ, ๋จผ์ € ์„ค์ •๋œ ์ด๋ฏธ์ง€๊ฐ€ ์ „๋ฉด์— ์ถœ๋ ฅ๋œ๋‹ค.

<!DOCTYPE html>
<html lang="en">
  <head>
    <style>
      div {
        height: 100vh;
        background-image: url("http://poiemaweb.com/img/bg/dot.png"),
          url("http://poiemaweb.com/img/bg/paper.gif");
        background-repeat: no-repeat, repeat;
      }
    </style>
  </head>
  <body>
    <div>Background-image</div>
  </body>
</html>

4. background-size ํ”„๋กœํผํ‹ฐ

๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€์˜ ์‚ฌ์ด์ฆˆ๋ฅผ ์ง€์ •ํ•œ๋‹ค. ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€์˜ ๊ณ ์œ  ๋น„์œจ์„ ์œ ์ง€ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์„ค์ •์— ๋”ฐ๋ผ ์ด๋ฏธ์ง€์˜ ์ผ๋ถ€๊ฐ€ ๋ณด์ด์ง€ ์•Š์„ ์ˆ˜ ์žˆ๋‹ค. background-size ํ”„๋กœํผํ‹ฐ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€์˜ ํฌ๊ธฐ๋ฅผ ์กฐ์ ˆํ•  ์ˆ˜ ์žˆ๋‹ค. ํŠนํžˆ ํ™”๋ฉด์— ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€๋ฅผ ๊ฐ€๋“ ์ฑ„์›Œ์•ผ ํ•  ๊ฒฝ์šฐ์— ์œ ์šฉํ•˜๋‹ค.

์•„๋ž˜์˜ ํ‘œ๋Š” background-size ํ”„๋กœํผํ‹ฐ๊ฐ’์ด๋‹ค.

์ข…๋ฅ˜
์„ค๋ช…

auto

์›๋ž˜ ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€ ํฌ๊ธฐ๋งŒํผ ํ‘œ์‹œํ•œ๋‹ค. ๊ธฐ๋ณธ๊ฐ’

contain

์š”์†Œ ์•ˆ์— ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€๊ฐ€ ๋‹ค ๋“ค์–ด์˜ค๋„๋ก ์ด๋ฏธ์ง€๋ฅผ ํ™•๋Œ€ ์ถ•์†Œํ•œ๋‹ค.

cover

๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€๋กœ ์š”์†Œ๋ฅผ ๋ชจ๋‘ ๋ฎ๋„๋กœ ์ด๋ฏธ์ง€๋ฅผ ํ™•๋Œ€ ์ถ•์†Œํ•œ๋‹ค.

<ํฌ๊ธฐ>

์ด๋ฏธ์ง€์˜ ๋„ˆ๋น„์™€ ๋†’์ด๋ฅผ ์ง€์ •ํ•œ๋‹ค. ๊ฐ’์ด ํ•˜๋‚˜๋งŒ ์ฃผ์–ด์งˆ ๊ฒฝ์šฐ ๋„ˆ๋น—๊ฐ’์œผ๋กœ ์ธ์‹ํ•˜๋ฉฐ, ์ด๋ฏธ์ง€์˜ ๋„ˆ๋น„์™€ ๋„ˆ๋น—๊ฐ’์— ๋งž์ถ˜ ๋†’์ด๊ฐ’๋„ ์ž๋™ ๊ณ„์‚ฐ๋œ๋‹ค.

<๋ฐฑ๋ถ„์œจ>

๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€๊ฐ€ ๋“ค์–ด๊ฐˆ ์š”์†Œ์˜ ํฌ๊ธฐ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๊ฐ’์„ ๋ฐฑ๋ถ„์œจ๋กœ ์ง€์ •ํ•˜๊ณ  ๊ทธ ํฌ๊ธฐ์— ๋งž๋„๋ก ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€๋ฅผ ํ™•๋Œ€ ์ถ•์†Œํ•œ๋‹ค.

<!DOCTYPE html>
<html lang="en">
  <head>
    <style>
      .bg {
        display: inline-block;
        width: 200px;
        height: 200px;
        background-image: url("https://images.unsplash.com/photo-1480714378408-67cf0d13bc1b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80");
        background-repeat: no-repeat;
      }
      .bg1 {
        background-size: auto;
      }
      .bg2 {
        background-size: contain;
      }
      .bg3 {
        background-size: cover;
      }
      .bg4 {
        /* ๋†’์ด๋Š” ์ž๋™ ๊ณ„์‚ฐ๋œ๋‹ค. */
        background-size: 100px;
      }
      .bg5 {
        background-size: 80% 80%;
      }
    </style>
  </head>
  <body>
    <div class="bg bg1">background-size: auto</div>
    <div class="bg bg2">background-size: contain</div>
    <div class="bg bg3">background-size: cover</div>
    <div class="bg bg4">background-size: ํฌ๊ธฐ</div>
    <div class="bg bg5">background-size: ๋ฐฑ๋ถ„์œจ</div>
  </body>
</html>

5. background-attachment ํ”„๋กœํผํ‹ฐ

์ผ๋ฐ˜์ ์œผ๋กœ ํ™”๋ฉด์„ ์Šคํฌ๋กคํ•˜๋ฉด ๋ฌธ์„œ ์ „์ฒด๊ฐ€ ์›€์ง์ด๋ฏ€๋กœ ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€๋„ ํ•จ๊ป˜ ์Šคํฌ๋กค๋œ๋‹ค. ํ™”๋ฉด์ด ์Šคํฌ๋กค๋˜๋”๋ผ๋„ ๋ฐฐ๊ฒฝ์ด๋ฏธ์ง€๋Š” ์Šคํฌ๋กค๋˜์ง€ ์•Š๊ณ  ๊ณ ์ •๋˜์–ด ์žˆ๊ฒŒ ํ•˜๋ ค๋ฉด background-attachment ํ”„๋กœํผํ‹ฐ์— fixed ํ‚ค์›Œ๋“œ๋ฅผ ์ง€์ •ํ•œ๋‹ค.

<!DOCTYPE html>
<html>
  <head>
    <style>
      *,
      *:after,
      *:before {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }
      html,
      body {
        width: 100%;
        height: 100%;
      }

      .bg-wrap {
        min-height: 600px;
        height: 100%;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;

        overflow: auto;
      }

      .parallax {
        background-image: url("http://poiemaweb.com/img/bg/stock-photo-125979219.jpg");
        background-attachment: fixed;
      }

      .normal {
        background-image: url("http://poiemaweb.com/img/bg/stock-photo-155153867.jpg");
        background-attachment: fixed;
      }
      p {
        padding: 30px;
        width: 600px;
        height: 320px;
        margin: 320px auto;
        background-color: white;
        text-align: center;
        display: flex;
        align-items: center;
      }
    </style>
  </head>
  <body>
    <div class="bg-wrap parallax">
      <p>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia harum
        consequatur reprehenderit id nulla tenetur fugit aperiam natus
        asperiores quos facilis veniam perferendis omnis doloremque ipsum,
        delectus laudantium, commodi accusamus?
      </p>
    </div>
    <div class="bg-wrap normal">
      <p>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia harum
        consequatur reprehenderit id nulla tenetur fugit aperiam natus
        asperiores quos facilis veniam perferendis omnis doloremque ipsum,
        delectus laudantium, commodi accusamus?
      </p>
    </div>
  </body>
</html>

์œ„์™€ ์•„๋ž˜์˜ ๋ฐฐ๊ฒฝํ™”๋ฉด์„ ๋ชจ๋‘ ๊ณ ์ •์‹œ์ผฐ๊ธฐ ๋•Œ๋ฌธ์— ์Šคํฌ๋กค์„ ํ•ด๋„ ์›€์ง์ด์ง€ ์•Š๋Š”๋‹ค.

์ง€๊ธˆ๊นŒ์ง€ ํ•œ ๋ฒˆ๋„ ์‚ฌ์šฉํ•˜์ง€ ์•Š์•˜๋˜ ํ”„๋กœํผํ‹ฐ์ด๋‹ค. ํ•˜์ง€๋งŒ ์ง์ ‘ ์ ์šฉํ•˜๊ณ  ๋ณด๋‹ˆ ์™„์ „ ๋ฉ‹์ ธ..


6. background-position ํ”„๋กœํผํ‹ฐ

์ผ๋ฐ˜์ ์œผ๋กœ background-image๋Š” ์ขŒ์ƒ๋‹จ๋ถ€ํ„ฐ ์ด๋ฏธ์ง€๋ฅผ ์ถœ๋ ฅํ•œ๋‹ค. background-position ์†์„ฑ์„ ์ด์šฉํ•˜๋ฉด ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€์˜ ์ˆ˜ํ‰ ์œ„์น˜ ๋˜๋Š” ์ˆ˜์ง ์œ„์น˜์˜ ๊ฐ’์„ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

๊ธฐ๋ณธ๊ฐ’ background-position: 0% 0%; ๊ธฐ๋ณธํ˜• background-position: <์ˆ˜ํ‰ ์œ„์น˜> <์ˆ˜์ง ์œ„์น˜>;

ํ”„๋กœํผํ‹ฐ๊ฐ’์„ ํ•˜๋‚˜๋งŒ ์ง€์ •ํ•œ๋‹ค๋ฉด ์›น ๋ธŒ๋ผ์šฐ์ €์—์„œ๋Š” ์ง€์ •ํ•œ ๊ฐ’์„ ์ˆ˜ํ‰ ์œ„์น˜๊ฐ’์œผ๋กœ ๊ฐ„์ฃผํ•˜๊ณ , ์ˆ˜์ง ์œ„์นซ๊ฐ’์€ 50%๋‚˜ center๋กœ ๊ฐ„์ฃผํ•œ๋‹ค.

<!DOCTYPE html>
<html>
  <head>
    <style>
      div {
        display: inline-block;
        width: 400px;
        height: 400px;
        background-color: orange;
        background-image: url("https://images.unsplash.com/photo-1657664043009-c4975cb4eed3?ixlib=rb-1.2.1&ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1074&q=80");
        background-size: 150px 150px;
        background-repeat: no-repeat;
        margin-top: 10px;
      }

      .ex1 {
        background-position: top;
      }
      .ex2 {
        background-position: bottom;
      }
      .ex3 {
        background-position: center;
      }
      .ex4 {
        background-position: left;
      }
      .ex5 {
        background-position: right;
      }
      .ex6 {
        background-position: 25% 75%;
      }
      .ex7 {
        background-position: 10px 20px;
      }
    </style>
  </head>
  <body>
    <div class="ex1">top</div>
    <div class="ex2">bottom</div>
    <div class="ex3">center</div>
    <div class="ex4">left</div>
    <div class="ex5">right</div>
    <div class="ex6">25% 75%</div>
    <div class="ex7">10px 20px</div>
  </body>
</html>

7. background-origin ํ”„๋กœํผํ‹ฐ

background-origin ํ”„๋กœํผํ‹ฐ๋ฅผ ์ง€์ •ํ•˜์—ฌ ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€๋ฅผ ํŒจ๋”ฉ๊นŒ์ง€ ํ‘œ์‹œํ•˜๊ฑฐ๋‚˜ ํ…Œ๋‘๋ฆฌ๊นŒ์ง€ ํฌํ•จํ•ด์„œ ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ๋‹ค.

์•„๋ž˜์˜ ํ‘œ๋Š” background-origin ํ”„๋กœํผํ‹ฐ๊ฐ’์ด๋‹ค.

์ข…๋ฅ˜
์„ค๋ช…

content-box

๋ฐ•์Šค ๋ชจ๋ธ์—์„œ ๋‚ด์šฉ ๋ถ€๋ถ„์—๋งŒ ์ด๋ฏธ์ง€๋ฅผ ํ‘œ์‹œํ•œ๋‹ค. ๊ธฐ๋ณธ๊ฐ’

padding-box

๋ฐ•์Šค ๋ชจ๋ธ์—์„œ ํŒจ๋”ฉ๊นŒ์ง€ ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€๋ฅผ ํ‘œ์‹œํ•œ๋‹ค.

border-box

๋ฐ•์Šค ๋ชจ๋ธ์—์„œ ํ…Œ๋‘๋ฆฌ๊นŒ์ง€ ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€๋ฅผ ํ‘œ์‹œํ•œ๋‹ค.

<!DOCTYPE html>
<html>
  <head>
    <style>
      div {
        display: inline-block;
        width: 400px;
        height: 400px;
        background-color: orange;
        background-image: url("https://images.unsplash.com/photo-1657664043009-c4975cb4eed3?ixlib=rb-1.2.1&ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1074&q=80");
        background-size: 150px 150px;
        background-repeat: no-repeat;
        margin-top: 10px;
        border: 50px solid rgba(10, 10, 10, 0.3);
        padding: 20px;
        background-position: top right;
      }

      .ex1 {
        /* ๊ธฐ๋ณธ๊ฐ’ */
        background-origin: content-box;
      }
      .ex2 {
        background-origin: padding-box;
      }
      .ex3 {
        background-origin: border-box;
      }
    </style>
  </head>
  <body>
    <div class="ex1">content-box</div>
    <div class="ex2">padding-box</div>
    <div class="ex3">border-box</div>
  </body>
</html>

8. background-color ํ”„๋กœํผํ‹ฐ

๋ฐฐ๊ฒฝ์ƒ‰์„ ์ง€์ •ํ•˜๋ ค๋ฉด ๋ฐฐ๊ฒฝ์„ ๋„ฃ๊ณ  ์‹ถ์€ ์š”์†Œ์˜ ์Šคํƒ€์ผ ๊ทœ์น™์„ ๋งŒ๋“ค ๋•Œ background-color ํ”„๋กœํผํ‹ฐ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. background-color๋Š” 16์ง„์ˆ˜๋‚˜ rgb๊ฐ’ ๋˜๋Š” ์ƒ‰์ƒ ์ด๋ฆ„์„ ์‚ฌ์šฉํ•˜์—ฌ ์ง€์ •ํ•œ๋‹ค. ๋˜ํ•œ transparentํ‚ค์›Œ๋“œ๋ฅผ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

div {
  background-color: #000000;
  background-color: rgb(255, 255, 255);
  background-color: white;
}

9. background-clip ํ”„๋กœํผํ‹ฐ

๋ฐฐ๊ฒฝ์„ ๋„ฃ๊ณ  ์‹ถ์€ ์š”์†Œ๋งˆ๋‹ค ์†์„ฑ์„ ์ž…๋ ฅํ•˜๋ฉด ๋˜์ง€๋งŒ ๋ฐ•์Šค ๋ชจ๋ธ ๊ด€์ ์—์„œ ๋ฐฐ๊ฒฝ์˜ ๋ฒ”์œ„๋ฅผ ์กฐ์ ˆํ•  ์ˆ˜๋„ ์žˆ๋‹ค. ํ…Œ๋‘๋ฆฌ๊นŒ์ง€ ์ ์šฉํ• ์ง€, ํŒจ๋”ฉ ๋ฒ”์œ„๊นŒ์ง€ ์ ์šฉํ• ์ง€, ์•„๋‹ˆ๋ฉด ๋‚ด์šฉ ๋ถ€๋ถ„์—๋งŒ ์ ์šฉํ• ์ง€ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋‹ค.

์ข…๋ฅ˜
์„ค๋ช…

border-box

๋ฐ•์Šค ๋ชจ๋ธ์˜ ๊ฐ€์žฅ ์™ธ๊ณฝ์ธ ํ…Œ๋‘๋ฆฌ๊นŒ์ง€ ์ ์šฉํ•œ๋‹ค. ๊ธฐ๋ณธ๊ฐ’

padding-box

๋ฐ•์Šค ๋ชจ๋ธ์—์„œ ํ…Œ๋‘๋ฆฌ๋ฅผ ๋บ€ ํŒจ๋”ฉ ๋ฒ”์œ„๊นŒ์ง€๋งŒ ์ ์šฉํ•œ๋‹ค.

content-box

๋ฐ•์Šค ๋ชจ๋ธ์—์„œ ๋‚ด์šฉ(์ฝ˜ํ…์ธ ) ๋ถ€๋ถ„์—๋งŒ ์ ์šฉํ•œ๋‹ค.

<!DOCTYPE html>
<html>
  <head>
    <style>
      div {
        display: inline-block;
        width: 400px;
        height: 400px;
        background-color: orange;
        background-size: 150px 150px;
        background-repeat: no-repeat;
        margin-top: 10px;
        border: 50px solid rgba(10, 10, 10, 0.3);
        padding: 20px;
        background-position: top right;
      }

      .ex1 {
        background-clip: content-box;
      }
      .ex2 {
        background-clip: padding-box;
      }
      .ex3 {
        /* ๊ธฐ๋ณธ๊ฐ’ */
        background-clip: border-box;
      }
    </style>
  </head>
  <body>
    <div class="ex1">content-box</div>
    <div class="ex2">padding-box</div>
    <div class="ex3">border-box</div>
  </body>
</html>

10. background Shorthand

background-color, background-image, background-repeat, background-position๋ฅผ ํ•˜๋ฒˆ์— ์ •์˜ํ•˜๊ธฐ ์œ„ํ•œ Shorthand Syntax์ด๋‹ค.

๊ธฐ๋ณธํ˜• background: color || image || repeat || attachment || position

<!DOCTYPE html>
<html>
  <head>
    <style>
      div {
        width: 400px;
        height: 400px;
        background: orchid
          url("https://images.unsplash.com/photo-1446776811953-b23d57bd21aa?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1172&q=80")
          no-repeat top left;
        background-size: 200px 200px;
      }
    </style>
  </head>
  <body>
    <div></div>
  </body>
</html>

11. Conclusion

background๊ด€๋ จ ํ”„๋กœํผํ‹ฐ๋Š” ์ž์ฃผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ ์ค‘ ํ•˜๋‚˜์ด๋‹ค. ๊ทธ๋ž˜์„œ ๋งŽ์ด ์‚ฌ์šฉํ•ด์™”๋‹ค. ์ฒ˜์Œ ํ•ด๋‹น ํ”„๋กœํผํ‹ฐ๋ฅผ ์‚ฌ์šฉํ–ˆ์„ ๋•Œ์—๋Š” backgrounbd-position, background-size๋ฅผ ํ†ตํ•ด ์ด๋ฏธ์ง€๋ฅผ ๋ฐ•์Šค์— ์ž˜ ๋งž๊ฒŒ ๊ตฌ์„ฑํ•˜๋Š” ๊ฒƒ ๊นŒ์ง€๋งŒ ํ•ด๋„ ๊ต‰์žฅํžˆ ๊ธฐ๋ถ„์ด ์ข‹์•˜๊ณ  ์ดํ›„์—๋Š” ๋‹ค๋ฅธ ํ”„๋กœํผํ‹ฐ์— ๋Œ€ํ•ด ์ž˜ ์•Œ์•„๋ณด์ง€ ์•Š๊ณ  ์ง€๋‚ด์™”๋‹ค. ์ด๋ฒˆ์— ๊ณต๋ถ€ํ•˜๋ฉด์„œ ํ•œ ๋ฒˆ๋„ ์‚ฌ์šฉํ•ด๋ณด์ง€ ์•Š์•˜๋˜ background-attachment ํ”„๋กœํผํ‹ฐ๋ฅผ ์ฒ˜์Œ ์‚ฌ์šฉํ•ด๋ดค๋Š”๋ฐ ์ •๋ง ์‹ ์„ธ๊ณ„์˜€๋‹ค. ๋ฐฐ๊ฒฝ์ด๋ฏธ์ง€๊ฐ€ ์Šคํฌ๋กค๋˜์ง€ ์•Š๊ณ  ๊ทธ ์ž๋ฆฌ ๊ทธ๋Œ€๋กœ ์žˆ๋‹ค๋Š” ๊ฒƒ์ด ๊ธ€๋กœ๋Š” ์ดํ•ด๊ฐ€ ์ž˜ ๋˜์ง€ ์•Š์•˜๋Š”๋ฐ ์ง์ ‘ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ๊ฒฐ๊ณผ๋ฌผ์„ ๋ณด๋‹ˆ ๋„ˆ๋ฌด ๋ฉ‹์กŒ๋‹ค. ๊ทธ๋ž˜์„œ ํ•ด๋‹น ํ”„๋กœํผํ‹ฐ๋ฅผ ๋ฐฐ์šฐ๊ณ  ์ž ๊น ๋ฉˆ์ถ˜ ํ›„ ๊ณ„์†ํ•ด์„œ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์‹œ๋„๋ฅผ ํ–ˆ๋‹ค. ์ด ํ”„๋กœํผํ‹ฐ๋ฅผ ์•ž์œผ๋กœ ์ž˜ ํ™œ์šฉํ•˜์—ฌ ๋” ๋ฉ‹์ง„ ์›น ํŽ˜์ด์ฆˆ๋ฅผ ๋งŒ๋“ค์–ด์•ผ ๊ฒ ๋‹ค๐Ÿ˜ƒ


์ฐธ๊ณ 

poiemaweb 2-6 ๋ฐฑ๊ทธ๋ผ์šด๋“œ ๋„์„œ - HTML + CSS + ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์›น ํ‘œ์ค€์˜ ์ •์„


๐Ÿ‘†

๐Ÿ“… 2022-07-19

Last updated