Loading Depth Study
Preparing your workspace
Every normal HTML element can be understood as a box made of content, padding, border, and margin.
The CSS box model explains how browsers calculate the size and spacing of elements. The content area contains the actual text or child elements. Padding creates space inside the element around its content. Border surrounds the padding and content. Margin creates space outside the element. The box-sizing property changes how declared width and height are calculated. Using box-sizing: border-box is common because declared dimensions include padding and border, making layouts easier to reason about.
A course card may have 20px padding inside the card, a 1px border around it, and 16px margin between it and the next card.
.card {
width: 300px;
padding: 20px;
border: 1px solid #ddd;
margin: 16px;
box-sizing: border-box;
}The card gets a fixed width that includes its padding and border, with outside spacing created by the margin.