Every element on a web page is a box. Drag the sliders and watch how content, padding, border and margin stack up — and why a 200px box is often not 200px wide.
Read the CSS Box Model lessonwidth sets the content only — padding and border are added on top.
Hover or tap a layer to learn what it does.
content 220px
+ padding 20+20px
+ border 8+8px
= 0px
.box {
width: 220px;
height: 140px;
padding: 20px;
border-width: 8px;
border-style: solid;
border-color: #f59e0b;
border-radius: 8px;
margin: 24px;
font-size: 16px;
}