Interview Question

What is margin in CSS?

Margin creates space outside the border.

💡 Concept ✅ Quick Revision 🎨 CSS

Answer

Margin is transparent space outside an element’s border edge. β€’ Margins separate a box from neighboring boxes. β€’ Some block-axis margins can collapse. β€’ Auto margins can absorb available space in supported layout contexts.

💡 Simple Example

.card { margin: 2rem auto; }

⚡ Quick Revision

Margin creates space outside the border.