Skip to content
Clairos Learn

CSS basics · Lesson 5 of 12 · 7 minutes

CSS basics: Spacing with padding

Padding creates space inside the border; it does not separate the element from its neighbors.

Mastery 0/3Run itExplain itApply it
Web workshopInert preview · code inspection

Current edit

PreviewNo external resources

Understand the pattern

Padding creates space inside the border; it does not separate the element from its neighbors.

Padding creates space inside the border; it does not separate the element from its neighbors.

Misconceptions to reject

  • If the page fits one desktop viewport, no narrower viewport needs checking.
  • Hiding all overflow always makes content accessible.

The preview is a sanitized subset, not a full browser compatibility test.

Worked example and expected result
.notice { padding: 1rem; }
.notice { border: 1px solid #658b84; }
.notice { box-sizing: border-box; }

Padding creates space inside the border; it does not separate the element from its neighbors.

Try a variation

Adapt the final example to a different project name while retaining its structure and relationships. A different context still needs a real browser and accessibility check.

Explain it

Which statement correctly explains spacing with padding?

Apply it elsewhere

You reuse spacing with padding in a different project. What must still be verified?

Keep the momentum.

Complete the lab, then explain and apply the pattern.

Next: CSS basics: Spacing with marginTry an incident drill

Anonymous lesson and mastery progress lasts for this session. Sign in to keep synced lesson XP between sessions; mastery stays device-local. No speed bonus, lost lives, or hint penalties.

Keep learning

  1. 01CSS basics: Readable typographyFont size, line height, and line length work together. Line height without a unit scales with the text.Practice
  2. 02CSS basics: Spacing with marginMargin creates space outside an element. Block margins can collapse in normal flow.Practice
  3. 03CSS basics: BordersA visible border needs a style as well as a width and color; it participates in box sizing.Practice