Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda 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

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 3. Capítulo 3

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

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

Deslize para mostrar o menu

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

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 3. Capítulo 3
some-alt