flex-wrap: Tailwind CSS Flex class

The flex-wrap class allows flex items to wrap onto multiple lines if they dont fit within the containers width.


flex-wrap

The flex-wrap class allows flex items to wrap onto multiple lines if they don't fit within the container's width.

Example Code

html
<div class="flex flex-wrap items-center justify-center text-white p-5 font-bold bg-yellow-100">
<div class="bg-yellow-700 p-4 m-2 rounded">flex-wrap</div>
<div class="bg-yellow-700 p-4 m-2 rounded">flex-wrap</div>
<div class="bg-yellow-700 p-4 m-2 rounded">flex wrap</div>
</div>

Preview

flex-wrap
flex-wrap
flex wrap

How to Use

Add the flex-wrap class directly to your HTML element:

html
<div class="flex-wrap">
<!-- Your content here -->
</div>

Responsive Usage

Use Tailwind's responsive prefixes to apply flex-wrap at specific breakpoints:

html
<div class="sm:flex-wrap md:flex-wrap lg:flex-wrap">
Responsive element
</div>
  • sm:flex-wrap — applies from 640px and up
  • md:flex-wrap — applies from 768px and up
  • lg:flex-wrap — applies from 1024px and up

Customization

You can extend or override this utility in your tailwind.config.js. See the Tailwind CSS documentation for details on customizing your theme.

Windframe is an AI visual editor for rapidly building stunning web UIs & websites

Start building stunning web UIs & websites!

Build from scratch or select prebuilt tailwind templates