Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Working with Block-Level Elements | Box Model and Element Spacing
CSS Fundamentals
course content

Conteúdo do Curso

CSS Fundamentals

CSS Fundamentals

1. Introduction to CSS
2. Text Styles
3. Box Model and Element Spacing
4. Flexbox
5. Decorative Effects

bookWorking with Block-Level Elements

Block-level elements can be identified as rectangular, and they stack on top of each other. They prevent any other elements from sharing the same line with them. This behavior is achieved by applying the CSS property:

Main considerations when working with block-level elements:

  • They are inherently set to display: block;
  • Their width spans the entire width allowed by the parent element;
  • The height is initially determined by content, but it can be customized using CSS;
  • Each block element starts on a new line;
  • Properties like border, margin, padding, width, and height can be adjusted.

Now, let's explore an example where we manipulate width, height, and margin:

html

index

css

index

js

index

copy

Let's consider how we can center an element inside its parent.

html

index

css

index

js

index

copy

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

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