CSS flex-wrap Property


The flex-wrap CSS property is used in conjunction with CSS Flexbox to control how flex items behave when they exceed the available space within a flex container. It determines whether the flex items should wrap onto a new line when they no longer fit in the container's width. By default, flex items stay on a single line, but by setting flex-wrap to "wrap," they can wrap to the next line as necessary. This property allows for more responsive and flexible layouts, making it easier to design complex web page structures that adapt to different screen sizes and content lengths.

Initial value
Applies to
Flex containers
Computed value
As specified
JavaScript syntax

Interactive Demo

Item 1
Item 2
Item 3
Item 4
Item 5
Item 6


flex-wrap: nowrap | wrap | wrap-reverse


  • nowrapIndicates that flex items line up on a single line. This is the default value.
  • wrapIndicates that flex elements inside the container are located in several horizontal rows (in case of overflow). Flex elements are placed from left to right with the ltr direction (global HTML dir attribute, or CSS direction property with ltr value), and with rtl value they are placed from right to left.
  • wrap-reverseIndicates that the flex elements inside the container are arranged in several horizontal rows (in case of overflow) similar to the wrap value, but the lines are formed in the reverse order.


<div class="container"><div>A</div><div>B</div><div>C</div></div>
<div class="container2"><div>A</div><div>B</div><div>C</div></div>
<div class="container3"><div>A</div><div>B</div><div>C</div></div>
.container {
   display: -webkit-flex;
   display: flex; 
   -webkit-flex-wrap: nowrap; 
   flex-wrap: nowrap; 
.container2 {
   display: -webkit-flex; 
   display: flex;
   -webkit-flex-wrap: wrap; 
   flex-wrap: wrap; 
.container3 {
   display: -webkit-flex;
   display: flex; 
   -webkit-flex-wrap: wrap-reverse;
   flex-wrap: wrap-reverse;
div > div {
   width: 40%;
   height: 25px;
   border: 1px solid orange;
   background: white;

Browser Support

The following table will show you the current browser support for the CSS flex-wrap property.

Edge Chrome Firefox Opera Safari
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview

Last updated by CSSPortal on: 1st January 2024