CSS Interview Questions

This CSS quiz covers the questions you are most likely to hear in a front-end interview: the box model, specificity, positioning, em vs rem, hiding elements and the cascade keywords. Small snippets let you prove the answer instead of guessing.

Medium 10 questions ~6 minutes Pass at 80%

Choose a mode

Playing as a guest: sign in to keep your XP and streak.

Sample question

Question 1 of 10

With the default box-sizing: content-box, how wide is this box on screen (border included)?

.box {
  width: 200px;
  padding: 20px;
  border: 5px solid;
}
Show the answer

D. 250px With content-box, width is only the content: 200 + 20 * 2 padding + 5 * 2 border = 250px. With box-sizing: border-box the box would be exactly 200px.

What this quiz covers

  • The box model and box-sizing
  • Specificity, !important and initial
  • Positioning, z-index and margin collapsing
  • em vs rem calculations
  • Hiding elements: display, visibility, opacity

Questions people ask

Do I need an account?

No. Anyone can play. Sign in to keep your XP, streak, badges and history.

Can I retake it?

Yes. Your best score is kept, and the questions and answers are shuffled each time.