HTML & CSS Masterclass Tutorial

Comprehensive guide to modern HTML and CSS development.

Flexbox

Flexbox (Flexible Box Layout)

Flexbox is a one-dimensional layout model designed to distribute space along a single row or column. It makes aligning items vertically and horizontally incredibly easy.

The Flex Container (Parent)

Triggered by display: flex;. Properties applied to the parent:

  • flex-direction: row, column.
  • justify-content: Aligns items on the main axis (center, space-between, space-around).
  • align-items: Aligns items on the cross axis (center, stretch).
  • flex-wrap: Allows items to wrap to a new line if they run out of space.

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics