block
The default behavior for most structural elements. It creates a vertical flow by occupying all available horizontal space.
- Forces a new line before and after
- Occupies 100% of the parent width by default
- Respects width, height, margin, and padding
.target { display: block; }inline
Elements sit side-by-side like words in a sentence. They only take up as much space as their contents require.
- Does not force new lines
- Ignores width and height properties
- Vertical margins and padding do not affect the flow of other lines
.target { display: inline; }flex
Provides a powerful system for distributing space and aligning items within a container (the flex container).
- Children automatically become flex items
- Items can grow or shrink to fill space
- Enables high-level alignment (center, space-between, etc.)
.target { display: flex; }grid
A true 2D layout system. It allows you to align content into rows and columns with exact precision.
- Defines explicit columns and rows
- Supports overlapping elements (layering)
- Total control over spacing (gutters/gaps)
.target { display: grid; }inline-block
Combines properties of block and inline. Elements sit side-by-side but respect width/height.
- Sits side-by-side like inline elements
- Respects width, height, and vertical margins/padding
- Does not force a line break
.target { display: inline-block; }none
Removes the element from the document entirely. It takes up no space as if it didn’t exist.
- Element is removed from document flow
- Does not occupy any space
- Children are also removed
.target { display: none; }