HTML
[HTML] 크기 높이 색깔 설정_style_div
EmilyP
2021. 3. 15. 12:24
- .은 class를 명시할 때 사용, class는 여러번 (다른 언어의 class와는 다름)
- #은 id값을 명시할 때 사용 , id는 한번만
- 상자 안에 상자를 넣어줄 때 div 안에 div 내용을 넣어주면 됨
- margin:0; padding:0으로 공간 없애 줌
<!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>Top</title>
<style>
.top{
background:blue;
width:400px;
height:400px;
color:#fff;
}
#bottom{
background:red;
width:200px;
height:200px;
color:#fff
}
</style>
</head>
<body>
<div class="top">
<div id="bottom">
Bottom
</div>
</div>
</body>
</head>