Border-box alternate


Is this box-sizing: border-box style the same as when you set a div/ section to a size and the child element within it to 100%?
Seems like its doing same thing two different ways. Code is code but the latter just seems to make more sense to my brain (Sorta like how setting max-width’s make more sense to me than setting min-widths).


no, look at this example:,css,output

now un-comment the padding, see how the box is expanding? Now also un-comment box-sizing.

now the element shrinks again, because box-sizing: border-box makes padding and border part of width and height of element, rather then expanding the element.