{
"$schema": "../schemas/code-crispies-module-schema.json",
"id": "box-model",
"title": "WIP: Padding, Borders, and Margins",
"description": "Master the fundamental principles of space management in web design through the CSS box model. This module explores how content, padding, borders, and margins combine to create layout structures that are both visually appealing and structurally sound.",
"difficulty": "beginner",
"lessons": [
{
"id": "box-model-1",
"title": "Box Model Components",
"description": "The CSS box model consists of four concentric layers: content area (innermost), padding, border, and margin (outermost). Understanding how these components interact is essential for precise layout control.",
"task": "Add padding: 1rem to .box to create space between its content and border.",
"previewHTML": "
border: 2px solid darkslategray to .box.",
"previewHTML": "margin: 1rem to .margin-box to create space between it and the adjacent element.",
"previewHTML": "box-sizing: border-box to .border-box so padding and border are included in its width.",
"previewHTML": "margin-bottom: 2rem to .first. Notice the space between paragraphs equals 2rem (not 3rem) due to margin collapse.",
"previewHTML": "This paragraph has a bottom margin.
This paragraph has a top margin of 1rem.
margin: 1rem 2rem to .shorthand-box for 1rem top/bottom and 2rem left/right.",
"previewHTML": "padding: 1.5rem to .padding-box to add equal padding on all sides.",
"previewHTML": "border-bottom: 4px solid dodgerblue to .border-demo.",
"previewHTML": "