+25 XP
Lesson 29 - CSS Basics

CSS Margins & Padding

Control spacing around and inside elements

Welcome to Margins & Padding!

Margins and padding control the space around and inside your elements. They're super important for making your webpage look great!

Content

Padding (inside)

Margin (outside)

📦

Padding

Space INSIDE the element, between content and border

↔️

Margin

Space OUTSIDE the element, between elements

Think of it like this:

  • Padding = space between a picture and its frame
  • Margin = space between two picture frames on a wall