InstrumentsFlexbox Playground
Flexbox Playground
Adjust flex direction, wrapping, alignment and gap, with a live preview and copy-ready CSS.
Flexbox Playground
From 1 to 12 boxes in the preview and the sample markup.
The preview uses the current browser's flexbox layout, so spacing and wrapping can differ slightly between browsers.
.flex {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: stretch;
gap: 8px;
}<div class="flex"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div>
FAQ
Why does the preview look different in another browser?
The preview uses the flexbox layout of the browser you are using now. Spacing and wrapping can differ slightly between browsers and versions, so check the result in the browsers your users run.
What does wrap-reverse do?
It wraps items onto new lines like wrap does, but it stacks those lines in the opposite cross direction. In a row, the second line appears above the first.
Does the gap apply between items in both directions?
Yes. The gap is written in px and sits between items along both the main and cross axes. It does not add space at the outer edges of the container.
Related tutorials
§04Toolbox
Related tools
Personalize your path
Choose your experience level once.
Next Step
Build fundamentals after each tool run so you can apply concepts with confidence.