Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Box Model Basics | Styling Fundamentals
CSS Foundations

bookBox Model Basics

When you style elements in CSS, you are working with the box model. This model breaks every element down into four main parts, each affecting the element's appearance and how it interacts with other elements on the page.

First is the content area, which holds text, images, or other content. Directly surrounding the content is the padding. Padding creates space inside the element, between the content and the border. The border wraps around the padding and content, forming a visible outline or edge for the element. Finally, the margin is the space outside the border, separating the element from its neighbors.

Changing the padding increases the space between the content and the border, making the box appear larger without affecting the space outside. Adjusting the border adds thickness around the padding and content. Modifying the margin pushes other elements further away, creating separation between boxes on your page.

index.html

index.html

style.css

style.css

copy

With the example above, you can see how each part of the box model works together: the content is surrounded by padding, then a border, and finally margin that separates the box from everything else.

question mark

Which part of the box model creates space outside an element's border?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 3. Kapitel 3

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

Suggested prompts:

Can you give me a visual example of the box model?

How do I change the padding, border, or margin in CSS?

What happens if I set negative values for margin or padding?

Awesome!

Completion rate improved to 6.67

bookBox Model Basics

Swipe um das Menü anzuzeigen

When you style elements in CSS, you are working with the box model. This model breaks every element down into four main parts, each affecting the element's appearance and how it interacts with other elements on the page.

First is the content area, which holds text, images, or other content. Directly surrounding the content is the padding. Padding creates space inside the element, between the content and the border. The border wraps around the padding and content, forming a visible outline or edge for the element. Finally, the margin is the space outside the border, separating the element from its neighbors.

Changing the padding increases the space between the content and the border, making the box appear larger without affecting the space outside. Adjusting the border adds thickness around the padding and content. Modifying the margin pushes other elements further away, creating separation between boxes on your page.

index.html

index.html

style.css

style.css

copy

With the example above, you can see how each part of the box model works together: the content is surrounded by padding, then a border, and finally margin that separates the box from everything else.

question mark

Which part of the box model creates space outside an element's border?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 3. Kapitel 3
some-alt