Box sizing

noun

say it: “BOKS SIZE-ing” /bɑks ˈsaɪzɪŋ/

The CSS property that decides what width and height measure: only the content (content-box, the default) or the content plus padding and border (border-box).

What does box-sizing do?

box-sizing decides whether width and height include padding and border. border-box makes sizes behave the way most people expect.

*, *::before, *::after { box-sizing: border-box; }

In a sentence

  • “I switched the box sizing of every element to border-box, so a 300px card stayed 300px after I added padding.”

Level: Apprentice · More CSS terms at this level

Updated