CSS Foundations

Backgrounds and Borders

Learn how backgrounds and borders help separate page areas and make layouts easier to understand visually.

Starter 4 practice exercises 1 homework item

What you will learn

  • Explain what backgrounds and borders do on a page.
  • Recognize a few beginner background and border properties.
  • Notice how these rules can separate sections visually.
  • Read simple CSS background and border examples without confusion.

Lesson shape

14 minute lesson with 5 sections, 4 exercises, 5 checkpoint questions, and 1 homework submission.

Student mode saves sections, safe practice results, quiz progress, and completion status.

Lesson preview

Step-by-step structure before you start

Overview

Why section separation matters

A page feels easier to scan when sections are visually separated. Backgrounds and borders help create that separation without changing the page structure.

They can make cards, forms, or information boxes feel more organized.

Visual separation

Backgrounds and borders help the eye understand where one area ends and another begins.

Explain

Background basics

A background can fill the space behind the content in an element. Beginners often start with a simple background color.

Even a soft gray or warm white background can help a card stand out from the page behind it.

Subtle is enough

A light background color can improve structure without shouting for attention.

Explain

Border basics

A border adds a visible line around an element. Beginners often use borders to outline cards, buttons, or grouped content.

A border does not need to be heavy. Thin lines are often enough to improve clarity.

Gentle edges

Borders can define a box without making the page feel harsh.

Practice

Read a tiny example

If CSS says .card { background: #f6f7fb; border: 1px solid #d9dce5; }, the card gets a light background and a subtle outline.

That one rule already makes the card easier to notice and easier to separate from the page around it.

Two useful tools together

Background plus border often gives a card enough visual structure for a first design pass.

Wrap up

What to remember before lesson 6

Backgrounds and borders help define page areas, but spacing is what keeps those areas from feeling cramped.

The next lesson focuses on margin, padding, and spacing so boxes stop looking crowded.

Take this forward

A clear section needs styling and spacing working together.

Keep moving

Finish this lesson, then move forward without losing your place.

Use the student player for saved sections, safe practice, quiz progress, and completion tracking.