CSS Flexbox

What is Flexbox?

Flexbox (Flexible Box Layout) is a CSS layout mode designed to provide a more efficient way to arrange, align, and distribute space among items in a container, even when their size is unknown or dynamic.

Basic Concepts

.container{
  display:flex;          /* establishes flex context */
  flex-direction:row;   /* main axis direction */
  justify-content:center; /* align items on main axis */
  align-items:center;   /* align items on cross axis */
}

Live Demo

1
2
3

Common Properties

Further Reading

Explore other layout techniques: