LESSON 42 OF 100

Give content space with padding

Create space between panel content and its border.

Official sourceW3C CSS Box Model — paddingReviewed: 2026-08-26
STEP 1 · LEARN

How it works

Padding sits between content and border. Two values in the padding shorthand mean vertical first, then horizontal.

Correct example
.panel { padding: 16px 24px; }

The panel receives 16px above and below and 24px on the left and right.

Common mistake
.panel { padding: 0; }

Zero padding leaves the content against the box edge.

STEP 2 · APPLY

Your exercise

Complete the rule for .panel with padding: 16px 24px.

STEP 3 · BUILD

Write and see the result

index.htmlCSS
Safe resultisolated
The draft stays only in this browser.HTML and CSS allowed · scripts and network blocked
STEP 4 · CHECK

What needs to pass

0%not checked
  • The padding declaration uses 16px 24px.
  • The target element is present on the page.
Explain the solution logic

The selector identifies the element, and padding: 16px 24px applies the exact requested behaviour.