값이 auto인 margin 속성은 컨테이너 내에서 요소를 수평으로 가운데에 맞추는 데 사용됩니다. 다음 코드를 실행하여 여백을 구현할 수 있습니다. auto;
예시
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 200px;
margin: auto;
border: 2px dashed blue;
}
</style>
</head>
<body>
<p>This is demo text</p>
<div>
This is horizontally centered because it has margin: auto;
</div>
</body>
</html> 출력
