Blair  - Soul Eater [CSS 기본내용] html:5 문법2

• program/스파르타코딩클럽

[CSS 기본내용] html:5 문법2

oujin 2022. 1. 29. 16:28
728x90

ALT+b를 눌러서 사이트 열고 F5눌러서 변경사항 확인하기


<!DOCTYPE html>
<html lang="en">
<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>Document</title>

    <style>
        .box{                                                    //-> .box의 style 을 꾸미겠다
            background-color: green;                     //-> 배경색 지정
            width: 800px;                                    //-> 넓이
            height: 800px;                                   //-> 높이

            display: flex;                                      |
            flex-direction: column;                         | box를 기준으로 안에들은 것들을 가운데로 정렬
            justify-content: center;                         |(4줄을 항상 같이 쓴다고 생각)
            align-items: center;                             |  
        }
        .first{                                                    ->box 안의 first라 이름붙은 애를 꾸미겠다
            background-color: red;                        ->배경색 지정
            width: 300px;                                     ->넓이
            height: 300px;                                    ->높이

            margin-bottom: 10px;                          ->first의 아래로 10px띄우기
                                                                   margin-bottom /top /right /left 가 있다.
        }
        .second{                                                ->box 안의 first라 이름붙은 애를 꾸미겠다
            background-color: blue;                        ->배경색 지정
            width: 400px;                                      ->넓이
            height: 400px;                                     ->높이
        }
    </style>
</head>
<body>
    <div class="box">                                        -><div class="box"></div> : 이름표 box 지정 
            <div class="first">첫 번째 박스</div>       ->box 안에 속하는 이름표 first
            <div class="second">첫 번째 박스</div ->box 안에 속하는 이름표 second
    </div>
 
</body>
</html>
728x90