[WED] 2021-11-10 TIL

MINBOKΒ·2021λ…„ 11μ›” 10일
0

λ©‹μŸμ΄μ‚¬μžμ²˜λŸΌ

λͺ©λ‘ 보기
3/19
post-custom-banner

μ˜€λŠ˜μ€ mediaquery, button, perspective에 λŒ€ν•΄μ„œ λ°°μ› λ‹€.
μ‘Έμ—…κ³Όμ œν•˜λ©΄μ„œ 미디어쿼리가 κ°€μž₯ μ–΄λ €μ› κΈ°λ•Œλ¬Έμ—,
미디어쿼리 뢀뢄에 κ°€μž₯ 관심이 λ§Žμ•˜λŠ”λ°
κ°„λ‹¨ν•˜κ²Œ κ°€λ₯΄μ³μ£Όμ…”μ„œ μ’€ 아쉬웠닀πŸ˜₯

진도 λͺ» 따라간 뢀뢄을 ν˜Όμžμ„œ κ³΅λΆ€ν•˜κ³  μžˆλŠ”λ°,
λ‚΄κ°€ κ³΅λΆ€ν•˜λŠ” 속도보닀 맀일 진도 λ‚˜κ°€λŠ” 속도가 더 λΉ λ₯΄λ‹€πŸ˜…

μ•„ 이건 였늘 λ§Œλ“  λ²„νŠΌμ΄λ‹€.
짧은 μ‹œκ°„λ™μ•ˆ λ§Œλ“ κ±° μΉ˜κ³ λŠ” 예쁘게 λ§Œλ“€μ–΄μ§„κ±°κ°™λ‹€.
주말에 μ‹œκ°„μ΄ 생기면 더 예쁘게 λ§Œλ“€μ–΄λ΄μ•Όμ§€ 룰루✨

✨ μ½”λ“œλŠ” μ—¬κΈ°!

<!DOCTYPE html>
<html lang="ko">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>button</title>
    <style>
        .btn {
            border: 4px solid palevioletred;
            border-radius: 50%;
            padding: 20px 52px;
            background: none;
            color: palevioletred;
            font-size: 20px;
            position: relative;
            overflow: hidden;
            cursor: pointer;
            transition: all .5s;
            margin-left: 80px;
            width: 200px;
            height: 200px;
        }

        @keyframes wave {
            from {
                transform: rotate(0deg); 
            }
            to {
                transform: rotate(360deg);
            }
        }

        .inside {
            position: absolute;
            width: 300px;
            height: 300px;
            background: turquoise;
            opacity: 0.4;
            border-radius: 45%;
            top: 0;
            left: -100px;
            margin-top: 200px;
            transform: translateY(0);
            transition-duration: 5s;
            transition-timing-function: ease;
        }

        .btn:hover .inside {
            margin-top: 80px;
            animation: wave 8s;
        }

        .inside2 {
            position: absolute;
            width: 300px;
            height: 300px;
            background: violet;
            opacity: 0.4;
            border-radius: 45%;
            top: 0;
            left: 0px;
            margin-top: 200px;
            transform: translateY(0);
            transition-duration: 5s;
            transition-property: margin-top;
            transition-timing-function: ease;
        }

        .btn:hover .inside2 {
            margin-top: 80px;
            animation: wave 10s;
        }

    </style>
</head>

<body>
<div class="wrap">
        <button class="btn">Click Me!
            <div class="inside"></div>
            <div class="inside2"></div>
        </button>
</div>
</body>

</html>

CSS

πŸ”· reset CSS

μˆ˜μ—…μ„ 톡해 reset CSSλΌλŠ” 것을 μ•Œκ²Œλ˜μ—ˆλ‹€.
κΈ°λ³Έ μŠ€νƒ€μΌμ„ μ΄ˆκΈ°ν™”μ‹œμΌœμ„œ λ””μžμΈμ„ μ‰½κ²Œν•  μˆ˜μžˆλ„λ‘ν•˜λŠ”
역할을 ν•œλ‹€κ³  ν•œλ‹€.

✨reset css 링크 https://meyerweb.com/eric/tools/css/reset/

πŸ”· CSS selector - 볡합 μ„ νƒμž

  • ν•˜μœ„ μ„ νƒμž (곡백)
    : μ•ž μš”μ†Œμ˜ μžμ†(λͺ¨λ“  ν•˜μœ„μš”μ†Œ)을 선택함
    section p {
      text-shadow: none;
    }
  • μžμ‹ μ„ νƒμž (>)
    : μ•ž μš”μ†Œμ˜ μžμ‹(λ°”λ‘œ μ•„λž˜ ν•˜μœ„μš”μ†Œ)을 선택함

    section > p {
       text-shadow: none;
    }
  • 인접 ν˜•μ œ μ„ νƒμž (+)
    : μ•ž μš”μ†Œ μ§ν›„μ˜ λ’· μš”μ†Œ
    h1 + p {
      color: red;
    }
  • 일반 ν˜•μ œ μ„ νƒμž (~)
    : μ•ž μš”μ†Œ λ’€ λͺ¨λ“  λ’· μš”μ†Œ
    h1 ~ p {
      color: red;
    }

πŸ”· CSS selector - 속성 μ„ νƒμž

  • a[href]
    : aνƒœκ·Έ 쀑 hrefλ₯Ό μ†μ„±μ΄λ¦„μœΌλ‘œ 가진 λͺ¨λ“  μš”μ†Œλ₯Ό 선택함
  • div[class="red"]
    : div νƒœκ·Έ 쀑 classλͺ…이 red인 μš”μ†Œλ₯Ό 선택
    (클래슀 μš”μ†Œκ°€ red ν•˜λ‚˜λΏμΈκ²ƒ / red-cat, red apple λ“± μ•ˆλŒ)
  • div[class~="red"]
    : div νƒœκ·Έ 쀑 classλͺ…에 redκ°€ μžˆλŠ” μš”μ†Œλ₯Ό 선택
    ( κ³΅λ°±ν—ˆμš© ⁖ red cat(O) / redcat (X) )
  • div[class~="red"]
    : div νƒœκ·Έ 쀑 classλͺ…에 redκ°€ ν¬ν•¨λœ λͺ¨λ“  μš”μ†Œλ₯Ό 선택
  • a[href^="https"]
    : aνƒœκ·Έ 쀑 href이 https둜 μ‹œμž‘ν•˜λŠ” μš”μ†Œ
  • div[class$="pink"]
    : divνƒœκ·Έ 쀑 classλͺ…이 pink둜 λλ‚˜λŠ” μš”μ†Œ
  • a[href|="http"]
    : aνƒœκ·Έ 쀑 href이 httpμ΄κ±°λ‚˜ http둜 μ‹œμž‘ν•˜λŠ” μš”μ†Œ
    (λ…λ¦½λœ κ°’μ΄κ±°λ‚˜, ν•˜μ΄ν”ˆ(-)만 ν—ˆμš©λŒ )

πŸ”· 가상 클래슀 μ„ νƒμž

  • :hover
  • .wrap:first-child : class="wrap"의 첫번째 μžμ‹
  • .wrap:last-child : class="wrap"의 λ§ˆμ§€λ§‰ μžμ‹
  • .wrap:nth-child(n) : n번째 μžμ‹
  • .foo:nth-child(odd) : ν™€μˆ˜λ²ˆμ§Έ μžμ‹ (even이면 짝수번째 μžμ‹)

πŸ”· 가상 μš”μ†Œ μ„ νƒμž

  • ::before
  • ::after
post-custom-banner

0개의 λŒ“κΈ€