Interview Question

What is the box model in CSS?

The box model is content, padding, border, and margin.

💡 Concept ✅ Quick Revision 🎨 CSS

Answer

The CSS box model describes each element as content surrounded by padding, border, and margin. • Content dimensions form the inner box. • Padding and border increase the visible box under content-box sizing. • Margin creates transparent space outside the border.

💡 Simple Example

.card { box-sizing: border-box; width: 20rem; padding: 1rem; border: 1px solid; margin: 1rem; }

⚡ Quick Revision

The box model is content, padding, border, and margin.