CSS Flexbox Playground

Experiment with CSS Flexbox properties interactively. Adjust container and item settings, preview layouts in real time, and copy the generated CSS.

The CSS Flexbox Playground lets you visually explore every Flexbox property without writing code first. Configure container properties like flex-direction, flex-wrap, justify-content, align-items, align-content, and gap. Then fine-tune individual items with flex-grow, flex-shrink, flex-basis, align-self, and order. The live preview updates instantly so you can see exactly how each property affects layout. Copy the generated CSS with one click. Everything runs entirely in your browser; no data leaves your device.

Your data stays in your browser
Was this tool useful?
Tutorial

How to use

1
1

Set container properties

Choose flex-direction, flex-wrap, justify-content, align-items, align-content, and gap using the dropdown menus and slider.

2
2

Add and select items

Click Add Item to insert new flex children. Click any numbered box in the preview to select it and reveal per-item controls.

3
3

Tune individual items

Adjust flex-grow, flex-shrink, flex-basis, align-self, and order for the selected item to see how it behaves inside the container.

4
4

Copy the CSS

Review the generated CSS output at the bottom and click Copy to paste it directly into your project stylesheet.

Guide

Complete Guide to CSS Flexbox

Understanding the Flex Container

When you set display: flex on an element, it becomes a flex container and its direct children become flex items. The container controls the main axis (determined by flex-direction) and the cross axis (perpendicular to the main axis). All spacing and alignment properties operate along these two axes.

Main Axis Alignment with justify-content

justify-content distributes items along the main axis. flex-start packs items at the start; flex-end at the end; center groups them in the middle. space-between puts equal space between items; space-around adds equal space around each item; space-evenly distributes identical gaps between and around items.

Cross Axis Alignment with align-items

align-items positions items along the cross axis. stretch fills the full cross dimension; flex-start aligns to the start edge; flex-end to the end edge; center places items in the middle; baseline aligns items by their text baselines, which is useful when items have different font sizes.

Flex Item Sizing: grow, shrink, basis

flex-grow controls how items expand to fill extra space. flex-shrink controls how items contract when space is scarce. flex-basis sets the initial size before growing or shrinking. The shorthand flex: 1 1 0 means grow equally, shrink equally, starting from zero width.

Examples

Worked Examples

Example: Equal-Width Columns

Goal: Create three columns that share the available width equally.

1

Step 1: Set flex-direction to row (default).

2

Step 2: Select each item and set flex-grow to 1.

3

Step 3: Copy the CSS and apply it to your layout.

Result: Three columns that stretch equally regardless of content length.

Example: Sticky Footer Layout

Goal: Push a footer to the bottom of the page when content is short.

1

Step 1: Set flex-direction to column on the container.

2

Step 2: Give the main content item flex-grow 1 so it expands.

3

Step 3: Leave the header and footer with flex-grow 0.

4

Step 4: Copy the CSS.

Result: The footer stays at the bottom even when page content is minimal.

Use Cases

Use cases

Navigation Bar with Spaced Links

Set flex-direction to row and justify-content to space-between to create a horizontal navbar where the logo sits on the left and links are evenly distributed on the right. This classic pattern is the foundation of most responsive site headers.

Centered Hero Content

Use justify-content center and align-items center on a full-height container to perfectly center a heading, subtext, and call-to-action button. Flexbox centering replaces older margin-auto hacks with a single, readable declaration.

Responsive Card Grid with Wrapping

Set flex-wrap to wrap and give each card a flex-basis of around 300px. Cards flow into rows automatically and wrap onto new lines when the viewport shrinks, creating a responsive grid without media queries.

Frequently Asked Questions

?What is CSS Flexbox?

CSS Flexbox (Flexible Box Layout) is a one-dimensional layout method for arranging items in rows or columns. It distributes space dynamically and aligns items with minimal CSS.

?When should I use Flexbox instead of Grid?

Flexbox is ideal for one-dimensional layouts; a single row or column of items. CSS Grid is better for two-dimensional layouts where you need control over both rows and columns simultaneously.

?What does flex-grow do?

flex-grow determines how much a flex item should grow relative to the other items when extra space is available in the container. A value of 0 means the item will not grow; higher values make it take proportionally more space.

?What is the difference between align-items and align-content?

align-items aligns items within a single flex line along the cross axis. align-content controls the spacing between multiple flex lines when flex-wrap is enabled and the container has extra cross-axis space.

?Can I reorder items without changing the HTML?

Yes. The order property lets you visually reorder flex items without modifying the DOM. Items with lower order values appear first. The default order is 0.

?Is this Flexbox playground free?

Yes, this tool is completely free with no registration required. There are no limits, no premium features, and no ads.

?Is my data private and secure?

Absolutely. This playground runs entirely in your browser. No data is sent to any server. Your layout experiments stay completely private on your device.

?Does Flexbox work in all browsers?

CSS Flexbox has excellent browser support across all modern browsers including Chrome, Firefox, Safari, and Edge. No vendor prefixes are needed for current implementations.

Help us improve

How do you like this tool?

Every tool on Kitmul is built from real user requests. Your rating and suggestions help us fix bugs, add missing features and build the tools you actually need.

Rate this tool

Tap a star to tell us how useful this tool was for you.

Suggest an improvement or report a bug

Missing a feature? Found a bug? Have an idea? Tell us and we'll look into it.

Related Tools

Recommended Reading

Recommended Books on CSS Flexbox & Layout

As an Amazon Associate we earn from qualifying purchases.

Boost Your Capabilities

Recommended Products for Web Developers

As an Amazon Associate we earn from qualifying purchases.

Newsletter

Get Free Productivity Tips & New Tools First

Join makers and developers who care about privacy. Every issue: new tool drops, productivity hacks, and insider updates — no spam, ever.

Priority access to new tools
Unsubscribe anytime, no questions asked