Section 1 - Instruction!

Welcome to the CSS Box Model! This is a core concept you must understand for web layout. Every single HTML element on your page can be thought of as living inside its own box.

Understanding the layers of this box is the key to controlling spacing and layout.

Engagement Message

Let's get started, shall we?

Section 2 - Instruction

The content area is the innermost part, where your actual text or images appear. When you set a width and height on an element, you are defining the size of this content area.

This is the box that holds what the user sees and reads.

Engagement Message

What would happen to your content if you set a width that's too small for your text?

Section 3 - Instruction

Padding is the transparent space between your content and the element's border. It's like adding cushioning inside the box to give your content some breathing room.

Use padding: 10px; to add 10 pixels of space on all four sides of your content.

Engagement Message

When might you want to add more padding around text?

Section 4 - Instruction

The border is the visible outline that goes around the padding and content. You can control its width, style (like solid or dashed), and color.

Example: border: 2px solid red; creates a solid red outline around your element.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal