Introduction to Flexbox
Flexbox is a powerful CSS layout system for arranging items in one dimension.
What is Flexbox?
Flexbox makes it easy to:
- Align items horizontally or vertically
- Distribute space between items
- Reorder items without changing HTML
- Create responsive layouts
Creating a Flex Container
Add display: flex to create a flex container:
Loading CSS Playground...
Without flexbox, the boxes would stack vertically!
Interactive Flexbox Playground
Try changing the flex properties:
Loading Flexbox Playground...
Flex vs Block
Compare the difference:
Loading CSS Playground...
Flex Container Properties
The main properties on the container:
Loading CSS Playground...
Flex Item Properties
Properties on flex children:
Loading CSS Playground...
Common Flex Patterns
Centering Content
Loading CSS Playground...
Exercise: Create a Flex Row
Convert block items to a horizontal flex row:
Loading CSS Exercise...

