margin-top: <크기> | <백분율> | auto
margin-right: <크기> | <백분율> | auto
margin-bottom: <크기> | <백분율> | auto
margin-left: <크기> | <백분율> | auto
margin: <크기> | <백분율> | auto
속성
<html>
<head>
<meta charset="utf-8">
<style>
html, body {
width: 100%; height: 100%;
}
div {
width: 100px;
height: 100px;
display: inline-block;
}
.box1 { background-color: blue; }
.box2 { background-color: green; margin-left: 30px; }
</style>
</head>
<body>
<div class="box1"></div>
<div class="box2"></div>
</body>
</html>
실행 화면
<html>
<head>
<meta charset="utf-8">
<style>
div {
width: 300px;
height: 100px;
display: block;
margin: 30px;
}
.box1 { background-color: blue; }
.box2 { background-color: yellow; }
.box3 { background-color: red; }
</style>
</head>
<body>
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
</body>
</html>
실행 화면
<html>
<head>
<meta charset="utf-8">
<style>
html, body { width:100%; height: 100%; }
div {
width: 100px;
height: 100px;
display: inline-block;
margin: 30px;
}
.box1 { background-color: blue; }
.box2 { background-color: yellow; }
.box3 { background-color: red; }
</style>
</head>
<body>
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
</body>
</html>
실행 화면
padding-top: <크기> | <백분율> | auto
padding-right: <크기> | <백분율> | auto
padding-bottom: <크기> | <백분율> | auto
padding-left: <크기> | <백분율> | auto
padding: <크기> | <백분율> | auto
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
html, body {
width: 100%;
height: 100%;
}
div {
width: 300px;
height: auto;
display: inline-block;
color: white;
border: 1px solid #000000;
background: #0094ff;
}
.box1 { padding: 20px 12px 30px 20px; }
.box2 { padding: 20px; }
.box3 { padding-left: 20px; }
</style>
</head>
<body>
<div class="box1">동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라 만세</div>
<div class="box2">동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라 만세</div>
<div class="box3">동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라 만세</div>
</body>
</html>
실행 화면
[CSS 기초] 다단으로 편집하기 (0) | 2021.05.03 |
---|---|
[CSS 기초] CSS 포지셔닝과 주요 속성들 (0) | 2021.05.01 |
[CSS 기초] 테두리 관련 속성들 (0) | 2021.04.27 |
[CSS 기초] CSS와 박스 모델 (0) | 2021.04.26 |
[CSS 기초] 배경 색과 배경 이미지 (0) | 2021.04.24 |
댓글 영역