CSS #1

박상영·2020년 4월 9일
0
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Challenge: Seasonal ids</title>
        <style>
        body {
                background-color: rgb(247, 3, 92);
        }

body를 선택자로 지정하여 해당 페이지의 전체적인 바탕 색상을 변경할수있다.

         
        #winter {
            color: rgb;
        }
        
        .text {
            background-color: rgb;
        }
        </style>
    </head>

id와 class 를 지정하여 색을 추가했다.

    <body>
        
        <h1>Olaf's favorite seasons</h1>
        <h2 id="summer">Summer</h2>

Summer 가 h2태그로 지정이 되어있으니 id는 중복되지않게 소문자summer로 id를 해야한다.

        <p>He's a happy snowman, doing what frozen things do in summer.</p>
        
        <h2 id="winter">Winter</h2>
        <p class="text">He likes to stay in and cuddle</p>
    </body>
</html>

Winter 또한 h2태그로 묶여있으니 소문자인 winter 로 id를 지정하여 style태그를 사용했다. 만약 id가 Winter로 지정이 되어있으면 동작하지 않는다.
class를 지정하여 지정한 문단 안에있는 내용들을 색변경을 할 수 있다.

profile
backend

0개의 댓글