πŸ’»Coding/πŸ“’ CSS

CSS _μ„ νƒμž_μ•„μ΄λ””μ„ νƒμž

μŒμ€μ‘ 2021. 8. 26. 10:09
728x90
λ°˜μ‘ν˜•

CSS _μ„ νƒμž_μ „μ²΄μ„ νƒμž

CSS - μ„ νƒμž

- CSS의 문법 ν˜•μ‹μ€ μ„ νƒμž, 속성, μ†μ„±κ°’μœΌλ‘œ 이루어져 μžˆμŠ΅λ‹ˆλ‹€.

κ·Έλž˜μ„œ CSSμ—μ„œλŠ” μŠ€νƒ€μΌμ„ μ μš©ν•  λŒ€μƒμ„ μ„ νƒν•˜κΈ° μœ„ν•΄μ„œ μ„ νƒμžλ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€.

μ„ νƒμž(selector)의 μ’…λ₯˜

β–Ά μ•„이디(id) μ„ νƒμž
γ„΄ μžλ°”μŠ€ν¬λ¦½νŠΈμ—μ„œ μ€‘λ³΅λœ 아이디가 있으면 였λ₯˜κ°€ λ°œμƒν•˜κΈ° λ•Œλ¬Έμ— 같은 idλŠ” ν•œκ°œλ§Œ μ‚¬μš©!
γ„΄ νƒœκ·Έ μ„ μ–Έμ‹œ : id = "name"
γ„΄ CSS μ„ νƒμ‹œ : #name { 속성 : 속성값; }

 

[ html - css μ½”λ“œ ] 

<!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>css class μ„ νƒμž</title>
    <style>
        #name { color: red;}
    </style>
</head>
<body>
    <p id="name">CSS 아이디 μ„ νƒμž</p>
</body>
</html>

 

[ μ‹€ν–‰ν™”λ©΄ ]

728x90
λ°˜μ‘ν˜•