#4 most askedVery commonEasyBox model
The CSS box model
New to Box model? Learn it from scratch firstThe Box Model โ
๐ข Asked in real interviews
No reports yet. Were you asked this? Be the first to say where.Explain the CSS box model and box-sizing: border-box.
๐ค Answer it out loud, then check yourself
Say your answer as if the interviewer is listening (30โ90 seconds). Then reveal what a strong answer covers and tick what you said.
// content-box vs border-box, the arithmetic
const width = 200, padding = 20, border = 2;
console.log("content-box total width:", width + 2 * padding + 2 * border);
console.log("border-box total width:", width, "(content shrinks to", width - 2 * padding - 2 * border + ")");
Answer out loud first, then compare.
Want to rehearse it?Answer this to the AI interviewer and get a verdict โ