Course Content
CSS Fundamentals
CSS Fundamentals
Working 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
, andheight
can be adjusted.
Now, let's explore an example where we manipulate width
, height
, and margin
:
index
index
index
Let's consider how we can center an element inside its parent.
index
index
index
Everything was clear?