Flex wrap
The flex wrap class sets the flex-wrap property. It controls how flex items wrap onto multiple lines if there isn’t enough space for them.
flex-direction property sets the main and cross axis. The effects of flex-wrap change based on the container's direction.| CSS Shortcut class | Applied style |
|---|---|
|
|
|
|
|
|
Examples
Wrap
flex-wrap
These items wrap onto multiple lines or columns when they don’t fit in a single row or column. Wrapping occurs in the default direction based on the cross axis.
In row layouts, it wraps from start to end vertically.
In column layouts, it wraps from start to end horizontally.
1
2
3
<div class="d-flex flex-wrap">
<p>1</p>
<p>2</p>
<p>3</p>
</div>
Reverse wrap
flex-wrap-reverse
These items wrap onto multiple lines or columns when they don’t fit in a single row or column. Wrapping occurs in the reverse direction along the cross axis.
In row layouts, it wraps from end to start vertically.
In column layouts, it wraps from end to start horizontally.
1
2
3
<div class="d-flex flex-wrap-reverse">
<p>1</p>
<p>2</p>
<p>3</p>
</div>
No wrap
flex-nowrap
These items are forced onto one line without wrapping.
1
2
3
<div class="d-flex flex-nowrap">
<p>1</p>
<p>2</p>
<p>3</p>
</div>
xs:> 480pxsm:> 640pxmd:> 768pxlg:> 1024pxxl:> 1280px
<div class="xs:flex-wrap ...">
...
</div>