Skip to main content
L
Loopaloo
Buy Us a Coffee
All ToolsImage ProcessingAudio ProcessingVideo ProcessingDocument & TextPDF ToolsCSV & Data AnalysisConverters & EncodersWeb ToolsMath & ScienceGames
Guides & BlogAboutContact
Buy Us a Coffee
L
Loopaloo

Free online tools for developers, designers, and content creators. Your files are processed in your browser and are never uploaded - no accounts required. A few network utilities (like What's My IP and Currency Converter) call public APIs to do their job and say so on their pages.

support@loopaloo.com

Tool Categories

  • Image Tools
  • Audio Tools
  • Video Tools
  • Document & Text
  • PDF Tools
  • CSV & Data
  • Converters
  • Web Tools
  • Math & Science
  • Games

Company

  • About Us
  • Contact
  • Blog
  • FAQ

Legal

  • Privacy Policy
  • Terms of Service
  • Disclaimer

Support

Buy Us a Coffee

© 2026 Loopaloo. All rights reserved. Built with privacy in mind.

Privacy|Terms|Disclaimer
  1. Home
  2. Web Tools
  3. CSS Flexbox & Grid Playground
Add to favorites

CSS Flexbox & Grid Playground

Build Flexbox and Grid layouts by adjusting real boxes, with presets, per-item controls, warnings for settings that do nothing, and CSS that matches the preview.

Runs locally in your browserMore web toolsJump to full guide
Related readingCSS Layout: Understanding Flexbox and Grid9 min

Initializing in your browser…

You might also like

CSS Animation Generator

Create CSS keyframe animations visually: presets, easing curves and steps, a live preview, reduced-motion support and clean CSS to copy.

CSS Clip Path Generator

Cut elements into shapes with CSS clip-path: 16 presets, draggable points, circles and rounded insets, with CSS checked before you copy it.

Glassmorphism Generator

Create frosted glass CSS with blur, tint, border and shadow controls, presets, a live preview and help when the effect looks flat.

CSS Flexbox & Grid Playground: a worked example

You are building a navigation bar: a logo on the left, a group of links in the middle and a button on the right. You start from the Space Between layout, then wonder why making the links grow broke the spacing.

Space Between, then flex-grow 1 on item 2

Container   flex-direction row, flex-wrap nowrap,
            justify-content space-between, align-items center,
            gap 16px, padding 8px
Items       three, each min-width 80px
Preview     762px wide (746px inside the padding)
What CSS Flexbox & Grid Playground produces

What the preview and the CSS show

.container {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  align-content: normal;
  gap: 16px;
  padding: 8px;
  min-height: 400px;
}

Before    item 1 at 8px, item 2 at 341px, item 3 at 674px, each 80px wide
After     item 1 at 8px, item 2 at 104px and 554px wide, item 3 at 674px

[warning] justify-content shares out free space, and an item with
          flex-grow above 0 takes all of it, so this setting appears
          to do nothing.

Three 80px items and two 16px gaps use 272px of the 746px inside the container, leaving 474px of free space. space-between puts it into the two gaps, so item 2 sits exactly in the middle at 341px. Give item 2 flex-grow: 1 and it absorbs all 474px, growing to 554px, and there is nothing left for justify-content to share. That is the right result for a navigation bar whose middle should fill the space; if you wanted the links to stay compact and centred, keep flex-grow at 0 and let space-between do the work.

About the Flexbox and Grid Playground

Build a CSS layout by changing properties and watching real boxes move. Switch between Flexbox and Grid, start from a common layout such as a sidebar, a holy grail page or a dashboard, adjust the container and each item, and copy CSS that reproduces exactly what the preview shows.

Key features

  • Flexbox and Grid in one tool, with every property that changes the layout
  • Twelve starting layouts, each with a one-line explanation
  • Per-item settings: flex-grow, flex-shrink, flex-basis, order, spans, start lines and alignment
  • Column tracks checked as you type, with the column count shown
  • Warnings for settings that have no effect and values the browser will drop
  • Copied CSS that reproduces the preview exactly
  • Keyboard and touch friendly: every item can be selected and edited without a mouse
  • Runs entirely in your browser

How to use

  1. 1Choose Flexbox or Grid, then pick a starting layout such as Sidebar Layout or Dashboard.
  2. 2Change the container settings: direction, wrapping, alignment and gap for Flexbox, or the column and row tracks for Grid.
  3. 3Tap an item in the preview or the item list to edit it on its own.
  4. 4Add or remove items to see how the layout copes with more or less content.
  5. 5Check any warnings above the preview, then switch to the CSS tab or press Copy CSS.

How to get the layout you want from Flexbox and Grid

Flexbox for a row or a column. A flex container lays its children out along one axis. justify-content shares out the free space along that axis, align-items positions items across it, and flex-wrap decides whether items move to a new line when they run out of room. Each item has flex-grow, flex-shrink and flex-basis, which together decide how much of the free space it takes or gives back. Try the Equal Width preset and then change one item's flex-grow to see the space being shared.

Grid for rows and columns together. A grid container defines tracks with grid-template-columns and grid-template-rows, and items fill them in order or span several. The column field accepts any value CSS does, including repeat(12, 1fr), minmax(200px, 1fr) and repeat(auto-fill, minmax(200px, 1fr)), and tells you how many columns it makes. A value the browser cannot read is flagged with the part that is wrong, because a browser silently drops it and falls back to a single column. Each item can span columns and rows or start on a given line, and grid-auto-flow: row dense fills the holes that spans leave behind.

Settings that seem to do nothing. Two classic puzzles are called out as they happen. align-content only aligns the lines of a wrapping container, so it does nothing with flex-wrap set to nowrap. justify-content only moves free space around, so once an item has flex-grow above zero there is none left to share. A grid item that spans more columns than the grid has is flagged too: the browser adds narrow extra columns instead of clamping the span.

CSS that matches the preview. The CSS tab lists every declaration the preview uses, including each item's padding, minimum sizes and colour, under the class names .container and .item-1, .item-2 and so on. Paste it onto a container of the same width with the same children and you get the same layout. Rename the classes to suit your project and delete the colours you do not need.

Everything runs in your browser, and nothing you build is uploaded.

Examples

  • A page with a sidebar

    Start from Sidebar Layout: a 250px sidebar with flex-basis and a main area with flex-grow 1 that takes the rest.

  • Responsive cards with no media queries

    Pick Responsive Cards in Grid mode. repeat(auto-fill, minmax(200px, 1fr)) fits as many 200px columns as the container allows.

  • A dashboard

    Use the Dashboard preset, then give one item a column span of 2 and a row span of 2 to make a featured tile.

Tips & best practices

  • Set min-width: 0 on flex items that hold long text or code, so they can shrink below their content width.
  • Prefer gap over margins for spacing between items; it never adds space at the edges.
  • Use fr units for flexible grid columns and minmax() to stop them getting too narrow.
  • Change the visual order with order or grid placement sparingly, since keyboard and screen reader users follow the source order.

Frequently asked questions

When should I use Flexbox and when Grid?

Use Flexbox when items sit in a single row or column and their own sizes should drive the layout, such as a navigation bar or a button group. Use Grid when you want rows and columns to line up, such as a page layout or a card gallery. They combine well: Grid for the page, Flexbox inside each area.

Why does justify-content do nothing?

It distributes free space, and an item with flex-grow above zero takes all of it. Set flex-grow back to 0, or use margins or gap for spacing instead.

Why does align-content do nothing?

It aligns the lines of a wrapping flex container. With flex-wrap set to nowrap there is only one line, so use align-items to position the items instead.

What is the difference between auto-fill and auto-fit?

Both create as many columns as fit. auto-fill keeps empty columns when there are too few items to fill a row, while auto-fit collapses them so the items stretch to fill the width.

Why does the copied CSS include colours and padding?

So it reproduces the preview exactly. Item padding changes item sizes, which changes the layout. Keep the layout properties and remove the colours, font weight and border radius if you do not want them.

What does a grid line number such as -1 mean?

Lines are numbered from 1 at the start edge, and negative numbers count back from the end edge, so a column start of -1 means the last line of the explicit grid. Line 0 does not exist.

Does gap work in Flexbox?

Yes. gap adds space between flex items and between wrapped lines, never at the outer edges, and it is supported in all current browsers.

Related tools and how they differ

  • CSS Border Radius Generator: Rounds the corners of the boxes you have laid out.
  • CSS Box Shadow Generator: Adds depth to cards and panels once the layout is in place.
  • CSS Animation Generator: Animates elements with keyframes, ready to paste beside your layout CSS.

Further reading

  • CSS Layout: Understanding Flexbox and Grid9 min read

Private by design

This runs as client-side JavaScript. Keys, tokens, payloads, and other inputs never leave your device.