๋ฐ˜์‘ํ˜•
250x250
Recent Posts
ยซ   2024/12   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
๊ด€๋ฆฌ ๋ฉ”๋‰ด

Hello creators ๐Ÿ™Œ

1-9_ CSS ๊ฟ€ํŒ ํ•œ๋ฒˆ ๋” ๋ฐฐ์šฐ๊ธฐ ๋ณธ๋ฌธ

[WEB & AI] (feat. ์ทจ์ค€)/์ŠคํŒŒ๋ฅดํƒ€์ฝ”๋”ฉํด๋Ÿฝ_์›น๊ฐœ๋ฐœ์ข…ํ•ฉ๋ฐ˜

1-9_ CSS ๊ฟ€ํŒ ํ•œ๋ฒˆ ๋” ๋ฐฐ์šฐ๊ธฐ

๋ถ€์‹œ๋งค๋‚˜_HA 2023. 9. 27. 07:19
728x90
๋ฐ˜์‘ํ˜•

์ด๋ฒˆ ํšŒ์ฐจ ํ•™์Šต ๋ชฉํ‘œ (goal)


  • ์ดํ•ด ํ•˜๊ณ ์ž ํ•˜๋Š” ๊ฒƒ
    • 'CSS'
    • ==๋ถ€ํŠธ์ŠคํŠธ๋žฉ ํ™œ์šฉ ์œ„ํ•œ CSS ๋ฐฐ์šฐ๊ธฐ==

  • ๋งŒ๋“ค๊ณ ์ž ํ•˜๋Š” ๊ฒƒ์€?
    • ์ด๊ฒƒ์„ ๋งŒ๋“ค ๊ฒƒ ์ž„

  • ํ•™์Šต ๋ชฉํ‘œ
    • ๊ธฐ์ดˆ์ ์ธ CSS ์ง€์‹ + ๋ถ€ํŠธ์ŠคํŠธ๋žฉ ์ ์žฌ์ ์†Œ ํ™œ์šฉ


๋งŒ๋“ค์–ด๋ณด๊ธฐ


โ… . (์ด์ „ ๊ฐ•์˜ ๋ˆ„์ ) index.html ํŒŒ์ผ ๋งŒ๋“ค๊ณ  -> ๋ถ€ํŠธ์ŠคํŠธ๋žฉ ํƒฌํ”Œ๋ฆฟ ๋ณต์‚ฌํ•ด์„œ ๋„ฃ์€ ์ƒํƒœ์—์„œ ์‹œ์ž‘


์ด์ „ ๊ฐ•์˜ ๊นŒ์ง€ ํ•œ ์ฝ”๋“œ ์Šค๋‹ˆํŽซ ๐Ÿ”—
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>

<title>์ŠคํŒŒ๋ฅดํƒ€์ฝ”๋”ฉํด๋Ÿฝ | ๋ถ€ํŠธ์ŠคํŠธ๋žฉ ์—ฐ์Šตํ•˜๊ธฐ</title>
</head>

<body>

    <!-- <h1>์ด๊ฑธ๋กœ ์‹œ์ž‘ํ•ด๋ณด์ฃ !</h1> -->
    <button type="button" class="btn btn-primary">๋‚˜๋Š” ๋ฒ„ํŠผ์ด๋‹ค! (์ซณ๐Ÿ‘)</button>


</body>

</html>

โ…ก. ๊ธฐ๋ณธ HTML ๋กœ ๊ธฐ๋ณธ ๋ผˆ๋Œ€ ๋งŒ๋“ค๊ณ  -> CSS ๋กœ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊พธ๋ฏธ๊ธฐ (๋ถ€ํŠธ์ŠคํŠธ๋žฉ ์•„๋‹˜)



1. ๊ธฐ๋ณธ html ์ž‘์„ฑ ๋ฐ css ๋„ฃ๊ธฐ



(1) ๊ฐ€์šด๋ฐ๋กœ ์˜ค๊ฒŒ ํ•˜๊ธฐ โญโญโญ #display_flex

  • ์ด ๊ณผ์ •์—์„œ, ์ฒ˜์Œ ๋ณธ, ๋‚ฏ์„ , ๊ทธ๋Ÿฌ๋ฉด์„œ ์ค‘์š”ํ•œ ์ฝ”๋“œ ๋ธ”๋ก #code_snipet

          /* โญโญโญ ๊ฐ€์šด๋ฐ๋กœ ์†์‰ฝ๊ฒŒ ์ •๋ ฌํ•˜๊ธฐ (4๊ฐ€์ง€๊ฐ€ set) */
          display: flex;
    
          <!-- โญโญโญ  column, row ๋งŒ ๋ณ€๊ฒฝํ•˜๋ฉด์„œ ์“ด๋‹ค. --> 
          flex-direction: column;
    
          justify-content: center;
          align-items: center;



  • ๊ฒฐ๊ณผ๋ฌผ

    • ์‰ฝ๊ฒŒ ๊ฐ€์šด๋ฐ๋กœ ์˜ด

(2) ์ƒ๊ฐํ•ด๋ณผ ์ง€์  #๊ณต๋ถ€๋ฐฉ๋ฒ•๊ณ ๋ฏผ #What_i_learned

  • ์ด ์ƒˆ๋กœ์šด, ๋‚ฏ์„ , ํ•˜์ง€๋งŒ, ์ค‘์š”ํ•˜๋‹ค๊ณ  ๋Š๊ปด์ง€๋Š”๊ฒŒ ๋“ค์–ด์˜ด. ์ด๊ฑธ ์–ด๋–ป๊ฒŒ ๋ณต์Šต? ์–ด๋–ป๊ฒŒ ๊ด€๋ฆฌ? ์–ด๋””๊นŒ์ง€ ์•”๊ธฐ? ์–ด๋””๊นŒ์ง€ ๊ฒ€์ƒ‰?
  • ์–ด๋–ค ํ”„๋กœ์ ํŠธ์—์„œ ์ง„ํ–‰ํ•œ๊ฑด์ง€๋Š”, ์ด๋ฏธ, ์‚ฌ๋ผ์กŒ์„ ๊ฒƒ. ์ด๋ฏธ ํฌ์„ ๋˜๊ณ  ์žˆ์ง€ ์•Š๋‚˜.
  • ์šฐ์„ , ๋ฐ˜๋“œ์‹œ ๊ทธ ๋‹ค์Œ๋‚  ๋ณต์Šต์ด ๋“ค์–ด๊ฐ€์•ผ ํ•จ. ์ตœ์†Œํ•œ 3์ผ ๊ฐ„ ๋ˆ„์ ํ•ด์„œ ๋“ค์–ด๊ฐ€์•ผ ํ•จ. (์ตœ๋Œ€ 1์ฃผ์ผ ๊นŒ์ง€?)
  • ๋ฌธ์ œ๋Š” ๊ทธ ์ดํ›„์— ํ•„์š”ํ•œ ์ฝ”๋“œ๋ฅผ ์ฐพ์„ ๋•Œ.
    • ์ด๋•Œ, ๋‚˜ ์Šค์Šค๋กœ์—๊ฒŒ ๋ฌผ์–ด๋ณด๊ฒ ์ง€.
      • ํŒŒ์ด์ฌ? ์›น? ์ธ๊ณต์ง€๋Šฅ? ๋ฐ์ดํ„ฐ ๋ถ„์„?
      • ์ด๋ ‡๊ฒŒ ํ•ด์„œ, ํƒ€๊ณ  ํƒ€๊ณ  ๋“ค์–ด๊ฐ€์•ผ ๊ฒ ์ง€.
  • [1/26 ์ƒ๊ฐ] what i learned? ์˜ ๋ฐฉ์‹์œผ๋กœ ํ•˜๋Š”๊ฒŒ ์ค‘์š”ํ•˜๋ ค๋‚˜? โญโญโญโญโญ


2. ๋ฒ„ํŠผ ๊พธ๋ฏธ๊ธฐ

  • [์ฒ˜์Œ๋ณธ, ์ค‘์š” ์š”๊ธดํ•  ๊ฒƒ ๊ฐ™์€ syntax] : div ํƒœ๊ทธ ์•ˆ์— ์žˆ๋Š” button ๋‚ด์— ์ ‘๊ทผํ•˜๊ธฐ #์•„์ง๋‚ฎ์„ค๋‹ค

    /* โญโญโญ div ์•ˆ์— ์žˆ๋Š” button ๋‚ด ์ ‘๊ทผํ•˜๊ธฐ ์œ„ํ•œ syntax */
      .mytitle > button { 
          /* ๋ฒ„ํŠผ ์‚ฌ์ด์ฆˆ */
          width: 200px;
          height: 50px;
          }

  • [์ฒ˜์Œ๋ณธ, ์ค‘์š” ์š”๊ธดํ•  ๊ฒƒ ๊ฐ™์€ syntax] ๋งˆ์šฐ์Šค๊ฐ€ ์˜ฌ๋ผ๊ฐ€๋ฉด, ์„ ์ด ๊ตต์–ด์ง€๊ฒŒ ํ•˜๊ธฐ #์•„์ง๋‚ฎ์„ค๋‹ค

      /* ๋ฒ„ํŠผ์ด ์˜ฌ๋ผ๊ฐ”์„ ๋•Œ -> ๊ตต์–ด์ง€๊ฒŒ ํ•˜๊ธฐ */
      .mytitle > button:hover{
          border: 2px solid white;
      }


3. ํฐํŠธ ๋„ฃ๊ธฐ


(1) ๊ตฌ๊ธ€ ํฐํŠธ link ๊ฐ€์ ธ์™€์„œ -> ==title ๋ฐ‘์—== ๋„ฃ๊ธฐ

<!-- title ๋ฐ‘์— ๋„ฃ๊ธฐ -->
<link href="https://fonts.googleapis.com/css2?family=Gowun+Dodum&display=swap" rel="stylesheet">

(2) ๊ตฌ๊ธ€ ํฐํŠธ CSS ๋งํฌ ๊ฐ€์ ธ์™€์„œ -> ==style== ๋ฐ‘์— ๋„ฃ๊ธฐ

<!-- style ๋ฐ‘์— ๋„ฃ๊ธฐ -->
* {
font-family: 'Gowun Dodum', sans-serif;
}

Cf. ์‹ค์ œ ์ž‘์„ฑํ•œ ์ฝ”๋“œ ๋ธ”๋ก

<title>์ŠคํŒŒ๋ฅดํƒ€์ฝ”๋”ฉํด๋Ÿฝ | ๋ถ€ํŠธ์ŠคํŠธ๋žฉ ์—ฐ์Šตํ•˜๊ธฐ</title>

<!-- ํƒ€์ดํ‹€ ๋ฐ‘์— ๋„ฃ๊ธฐ โญโญโญ -->
<link href="https://fonts.googleapis.com/css2?family=Gowun+Dodum&display=swap" rel="stylesheet">

    <style> 
        <!-- style ๋ฐ‘์— ๋„ฃ๊ธฐ โญโญโญ -->
    * {
    font-family: 'Gowun Dodum', sans-serif;
    }


4. ์ด๋ฏธ์ง€ ์–ด๋‘ก๊ฒŒ ํ•˜๊ธฐ


(1) ์ฝ”๋“œ ์Šค๋‹ˆํŽซ ๋ณต์‚ฌ

linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5))

(2) ์–ด๋””์— ๋„ฃ์–ด?

background-image ์˜ ์ฒซ๋ฒˆ์งธ ์ธ์ž๋กœ ๋„ฃ์–ด

        /* ์ƒ์–ด ์ด๋ฏธ์ง€ ๋„ฃ๊ธฐ */
        background-image: linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("https://movie-phinf.pstatic.net/20210715_95/1626338192428gTnJl_JPEG/movie_image.jpg");
        background-position: center;
        background-size: cover;

(3) rbga 4๋ฒˆ์งธ ์ธ์ž 0.5 ๋ฅผ ์กฐ์ ˆํ•˜๋ฉด -> ๋ฐ๊ธฐ ์กฐ์ ˆ ๊ฐ€๋Šฅ

์ด์ œ ๋ถ€ํŠธ์ŠคํŠธ๋žฉ ์“ธ ๊ฒƒ! ๋‹ค์Œ ๊ฐ•์˜์—์„œ

728x90
๋ฐ˜์‘ํ˜•
Comments