HTML & CSS クイズ: The Box Model

This CSS quiz makes you do the math the browser does for every box. You will compute rendered widths with box-sizing: content-box and border-box, resolve percentage padding, and predict when vertical margins collapse.

ふつう 10問 約6分 合格ライン 80%

モードを選ぶ

ゲストとしてプレイ中です。ログインすると XP と連続記録が保存されます。

例題

第1問 / 全10問

How wide is the box on screen, from its left border edge to its right border edge?

.box {
  width: 200px;
  padding: 20px;
  border: 5px solid black;
  margin: 10px;
}
答えを見る

B. 250px The default box-sizing: content-box applies width to the content only: 200 + 20 + 20 + 5 + 5 = 250px. Margin is outside the border, so it adds space around the box but not to its border-box width.

このクイズの内容

  • Content, padding, border and margin
  • box-sizing: content-box vs border-box
  • Percentage padding and margin
  • Vertical margin collapsing between siblings and with parents
  • Centering a block with margin: 0 auto

よくある質問

アカウントは必要ですか?

いいえ、誰でも遊べます。ログインすると XP、連続記録、バッジ、履歴が保存されます。

何度でも挑戦できますか?

はい。ベストスコアが記録され、問題と選択肢は毎回シャッフルされます。