5. The box model: padding, border, margin
Este artículo se traducirá automáticamente. Por ahora se muestra en inglés.
Every element is a box: content, then padding (space inside the border), then the border, then margin (space outside the border).
padding: 12px sets all four sides. padding: 8px 16px sets top-bottom and left-right. The same shorthand works for margin.
Ver ejemplo
.box {
padding: 12px;
border: 2px solid navy;
margin: 20px;
}
✍️ Ahora te toca
Give .box a padding of 24px and a dashed border of 3px.