Starlit Daily

📚 › CSS: style and layout

5. The box model: padding, border, margin

इस लेख का अनुवाद अपने आप होगा। अभी अंग्रेज़ी में दिखाया जा रहा है।

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.

उदाहरण देखें

.box {
  padding: 12px;
  border: 2px solid navy;
  margin: 20px;
}

✍️ अब आपकी बारी

Give .box a padding of 24px and a dashed border of 3px.

← कोर्स पर वापस