margin
Copy HTML
<div class="margin-demo">
<div class="margin" dir="ltr">
margin
</div>
</div>Explore margin with interactive controls for all sides, per-side, or per-axis spacing, switch units, compare physical and logical properties, and use auto to push or center the block.
<div class="margin-demo">
<div class="margin" dir="ltr">
margin
</div>
</div>.margin-demo {
min-block-size: 20rem;
background-color: #f3f4f6;
}
.margin {
display: grid;
place-items: center;
inline-size: max-content;
padding: 1rem;
border: 1px dashed #f59e0b;
background-color: #ffffff;
margin: 24px;
}