Last updated: 11 May 2024

Tailwind CSS Flex wrap

The tailwind flex wrap utility class allows you to control whether flex items should wrap or stay on a single line within a flex container.


Tailwind Flex Wrap

The tailwind flex wrap utility class in Tailwind CSS allows you to control whether flex items should wrap or stay on a single line within a flex container. It provides a set of classes that enable you to easily specify the wrapping behavior, allowing you to create flexible and responsive layouts.

Setting Tailwind Flex Wrap

To set the tailwind flex wrap behavior of a flex container, you can use the flex class in combination with one of the following classes:

  • flex-wrap: This allows flex items to wrap onto multiple lines if needed.

  • flex-wrap-reverse: This allows flex items to wrap onto multiple lines in reverse order if needed.

  • flex-nowrap: This prevents flex items from wrapping and keeps them on a single line.

Tailwind Flex-wrap

Tailwind flex wrap class allows flex items to wrap onto multiple lines if needed.

html
<div class="flex flex-wrap....">
<div class="flex-1">A</div>
<div class="flex-1">B</div>
<div class="flex-1">C</div>
</div>

Preview

A
B
C

Tailwind Flex Wrap Reverse

Tailwind flex wrap reverse class allows flex items to wrap onto multiple lines in reverse order if needed

html
<div class="flex flex-wrap-reverse....">
<div class="flex....">A</div>
<div class="flex...">B</div>
<div class="flex...">C</div>
</div>

Preview

A
B
C

Tailwind Flex-Nowrap

Tailwind flex nowrap class prevents flex items from wrapping and keeps them on a single line

html
<div class="flex flex-nowrap....">
<div class="flex-none...">A</div>
<div class="flex-none...">B</div>
<div class="flex-none...">C</div>
</div>

Preview

A
B
C

That's it! You now have a good understanding of how to use the flex wrap utility classes in Tailwind CSS to control whether flex items should wrap or stay on a single line within a flex container.

Tailwind Flex Wrap Class Table

ClassProperties
flex-wrapflex-wrap: wrap
flex-wrap-reverseflex-wrap: wrap-reverse;
flex-nowrapflex-wrap: nowrap;

Windframe Tailwind blocks

footer

Windframe is a drag and drop builder for rapidly building tailwind css websites and UIs

Start building stunning tailwind UIs! 

Build from scratch or select prebuilt tailwind templates