Skip to main content

CSS Flexbox Generator – Build Flex Layouts Visually

Build CSS flexbox layouts visually. Set direction, wrap, alignment and gap, tune each item's grow, shrink and basis, then copy the CSS, HTML or Tailwind code.

CSS Flexbox Generator

Build flex layouts visually and copy the code.

Start with a preset

Or set every option below.

Preview

The preview box has a fixed height. Items are at least 64 × 48 px.

Generated code

Copy and paste directly into your project.

CSS
.flex-container {
  display: flex;
}

What is CSS Flexbox Generator?

Experiment with CSS flexbox and see every change instantly. Set flex-direction, flex-wrap, justify-content, align-items, align-content and gap on the container, add up to 12 items, and adjust each one's flex-grow, flex-shrink, flex-basis, align-self and order. Only the properties you change are written out. Start from a preset such as center, space between, column or wrap, and copy the CSS, the matching HTML or a Tailwind version.

  • flexbox
  • flex layout
  • justify-content
  • align-items
  • gap

Features

What you get with CSS Flexbox Generator.

  • Container and Item Controls

    Direction, wrap, alignment and gap on the container; grow, shrink, basis, align-self and order on each item.

  • Live Preview

    See the layout change instantly as you switch options and move sliders.

  • Clean Output

    Only the properties you change are written, so the code stays short.

  • CSS, HTML & Tailwind

    Copy the styles, the markup, or a Tailwind version.

How to use CSS Flexbox Generator

Follow these steps to get the best results.

  1. Set up the container

    Choose a preset or pick the direction, wrap, justify-content and align-items values.

  2. Tune the items

    Add or remove items, select one, and change its grow, shrink, basis, align-self or order.

  3. Copy the code

    Pick CSS, HTML or Tailwind and paste it into your project.

    Output
    .flex-container { display: flex; justify-content: center; align-items: center; }

Advertisement

In-feed adResponsive

Frequently asked questions

Common questions about CSS Flexbox Generator.

justify-content distributes items along the main axis, which is horizontal for a row and vertical for a column. align-items aligns them on the cross axis, the other direction.

Comments

Share feedback, ask questions, or help others use this tool.

Join the discussion

Sign in to comment, reply, and report inappropriate content.

Advertisement

Mobile banner adResponsive