⚡
usefultools.dev
⇔

CSS Flexbox Generator

NOUVEAU

Experiment with flex container and item properties visually and copy the flexbox CSS.

Fonctionne à 100 % dans votre navigateur — vos données ne sont jamais envoyées ni stockées sur nos serveurs.

Cet outil n'est pas encore entièrement traduit : une partie du texte est encore en anglais. L'outil lui-même fonctionne de la même façon dans toutes les langues.

Presets:
Container
Live preview (click an item to edit it)
Items (3/12)
CSS
.container {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: stretch;
  gap: 12px;
  height: 220px;
}

.item {
  padding: 16px;
  box-sizing: border-box;
}

.item-1 {
  height: 60px;
}

.item-2 {
  height: 100px;
}
HTML
<div class="container">
  <div class="item item-1">1</div>
  <div class="item item-2">2</div>
  <div class="item item-3">3</div>
</div>
⚡

Exemples rapides

Des entrées typiques et les résultats produits par cet outil.

Container
Centered preset
justify-content: center; align-items: center;
Items
Sidebar + content preset
flex: 0 0 160px; and flex: 1 1 auto;
Wrap
Wrapping cards preset
flex-wrap: wrap; flex: 1 1 30%;
Column
Column stack preset
flex-direction: column; gap: 8px;
📖

Présentation

Flexbox is the CSS layout model for arranging items in one dimension, a row or a column, with control over alignment, spacing and how items grow or shrink to fill the space. Its many properties are easy to confuse: justify-content works along the main axis, align-items along the cross axis, and align-content only matters when items wrap onto several lines.

This CSS flexbox generator lets you change every container property (flex-direction, flex-wrap, justify-content, align-items, align-content, gap) and every item property (flex-grow, flex-shrink, flex-basis, align-self, order, width, height) and see the result immediately in a live preview. Add or remove items, click one to edit it, and copy the matching CSS and HTML when the layout looks right.

Everything runs in your browser and the preview is real flexbox rendered by your own browser, so what you see is exactly what the copied code does. Use the presets (centered, navbar, sidebar, wrapping cards, column stack) as starting points for common patterns.

Pourquoi utiliser cet outil ?

  • See the effect of every flexbox property live
  • Per-item grow, shrink, basis, align-self and order
  • Copy clean CSS and matching HTML in one click
  • Presets for centering, navbars, sidebars and card grids
  • Validates values and explains mistakes
⭐

Fonctionnalités

🧭

All container properties

Direction, wrap, justify-content, align-items, align-content and gap.

🧩

Per-item controls

Set flex-grow, flex-shrink, flex-basis, align-self, order, width and height for each item.

👁️

Live preview

Rendered by your browser with real flexbox, so it always matches the code.

➕

Add and remove items

Test layouts with 1 to 12 items and click any item to edit it.

⚡

Presets

Start from centered, navbar, sidebar, wrapping cards or column stack.

📋

CSS and HTML export

Only non-default item declarations are emitted, keeping the CSS short.

🛠️

Mode d'emploi

1

Pick a preset or start fresh

Choose a preset layout, or change the container settings directly.

2

Tune the container

Set direction, wrap, justify-content, align-items, align-content and gap.

3

Edit the items

Add items, click one in the preview and adjust grow, shrink, basis, align-self and order.

4

Copy the code

Copy the CSS and HTML and paste them into your project.

🤔

Questions fréquentes