
바깥여백(margin) ★
테두리=경계선(border)
안쪽여백(padding) ☆
내용(content)
margin: 10px; 👉 상하좌우 모든 영역에 적용
margin: 10px 20px; 👉 10px(상하) 20px(좌우)
margin: 10px 20px 30px 40px; 👉10px(상) 20px(우) 30px(하) 40px(좌)
margin: auto; 👉 정중앙 정렬 (모든 화면,환경에 적용(오토))
padding은 오토 없음 😂
✅ 한 방향에만 방향을 주고 싶을 때 . . .👇
margin-top;
margin-bottom;
margin-right;
margin-left;

#div1 {
width: 200px;
height: 200px;
background-color: red;
margin: 50px 100px;
}
margin: 50px 100px; 👉 상하 바깥여백에 50px, 좌우 바깥여백에 100px

border: 20px solid black; 👉 두께 20에, 직선으로 검정색칠


😵 설명이 어렵다.. 느낌으로 ..알지?..
근데 이렇게 눈으로 봤을 때 헷갈리면 어렵겠지?
⭐ box-sizing: border-box; 👉 컨텐츠,공백의 크기를 합쳐서 원래 크기 유지

box-sizing: border-box; 를 통해서, 같은 사이즈로 눈으로 보임 !!

padding 예 ) 빨간 네모 박스 기준으로 안쪽여백(padding) 주면, 글자가 가운데로 모이는 검색창 생각 !!

<style>
div {
width: 200px;
height: 200px;
}
#div1{
background-color: lightpink;
margin-left: 400px;
}
#div2{
background-color: lightgray;
margin-left: 600px;
}
#div3{
background-color: lightgreen;
margin-left: 800px;
}
#div4{
background-color: lightskyblue;
margin-left: 1000px;
}
</style>
</head>
<body>
<div id="div1"></div>
<div id="div2"></div>
<div id="div3"></div>
<div id="div4"></div>
</body>
</html>
#div1{
width: 400px;
height: 400px;
background-color: rgb(178, 178, 178);
border : 1px inherit black;
border-radius: 150px;
}
#div2{
width: 300px;
height: 300px;
background-color: #646464;
border : 1px inherit black;
border-radius: 50%;
margin-left: 60px;
}
#div3{
width: 150px;
height: 150px;
background-color: white;
border : 1px inherit black;
border-radius: 50%;
margin-left : 80px;
}
span{
font-style: italic;
padding-left: 50px;
}
</style>
</head>
<body>
<div id="div1">
<div id="div2">
<div id="div3">
<div><span>domato</span></div>
</div>
</div>
</div>
</body>
