Flexbox Playground

Visually configure a CSS flexbox container and copy the generated CSS

Flex settings

Presets:

Live preview

1
2
3
4

CSS

.flex-container {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 8px;
}

Examples

Centered hero section

.flex-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  gap: 16px;
}

Centers items both horizontally and vertically — the classic pattern for a hero or modal.

Responsive wrapping card gallery

.flex-container {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 24px;
}

Cards wrap to new rows automatically and all stretch to the same height, ideal for a responsive grid of equal-height cards.

Details

CSS Flexbox is a one-dimensional layout model that makes it easy to align and distribute space among items in a container. This playground lets you tweak all the major flex-container properties — direction, justification, alignment, wrapping, and gap — and see numbered items react in real time. Everything runs locally in your browser; no data is ever sent anywhere.

About this tool

The Flexbox Playground is a visual configuration tool for CSS Flexbox containers. Adjust flex-direction, justify-content, align-items, flex-wrap, and gap through simple dropdowns and a slider, then watch numbered items react in the live preview — all without writing a single line of CSS by hand.

The generated output is a complete, production-ready .flex-container { display: flex; … } rule that you can paste straight into any stylesheet. Because all processing happens locally in your browser, no data ever leaves your device.

Whether you are learning how justify-content differs from align-items, prototyping a navigation bar, or debugging a wrapping layout, the Flexbox Playground gives you immediate visual feedback so you can apply Flexbox with confidence.

How to use

  1. Configure your flex container

    Use the dropdowns to choose flex-direction, justify-content, align-items, and flex-wrap, and drag the Gap slider. The live preview updates instantly.

  2. Use a preset to get started quickly

    Click a preset chip — Centered, Space between nav, Vertical stack, or Wrapping gallery — to load a common pattern, then fine-tune it.

  3. Copy and use the generated CSS

    Click Copy CSS to copy the complete .flex-container rule and paste it into your stylesheet.

Flex-container properties at a glance

PropertyOptions
flex-directionrow · row-reverse · column · column-reverse
justify-contentflex-start · center · flex-end · space-between · space-around · space-evenly
align-itemsstretch · flex-start · center · flex-end · baseline
flex-wrapnowrap · wrap · wrap-reverse
gap0 – 48 px

Frequently asked questions