HTML Content Box
Padding
By default, padding ADDS to the declared dimensions(see below)
Can have negative margin, but not negative padding
Margin
Margin is collapsable. So if divs stacked and top has margin-bottom: 40px and bottom one has margin-top 30px. Space between them will be 40px
Margin-auto horizontal centers div if it has set width
Border
See own section
Overview
Margin and Padding can be negative :0
Box-sizing
(Padding and Border within or outside declared width/height?
content-box => outside
border-box => Within
Box-Shadow
Last updated