Code has been added to clipboard!

The CSS Flex-Wrap Property

Reading time 1 min
Published Sep 25, 2019
Updated Oct 1, 2019

Explaining CSS flex wrapping

The CSS flex-wrap property specifies the placement of flex items in the lines of the flex container:

Example
#first { 
  display: -webkit-flex; /* Safari */ 
  -webkit-flex-wrap: nowrap; /* Safari 6.1+ */ 
  display: flex; 
  flex-wrap: nowrap; 
} 

#second { 
  display: -webkit-flex; /* Safari */ 
  -webkit-flex-wrap: wrap; /* Safari 6.1+ */ 
  display: flex; 
  flex-wrap: wrap; 
}
Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid certificates of completion
Coursera
Pros
  • Professional service
  • Flexible timetables
  • A variety of features to choose from
Main Features
  • Professional certificates of completion
  • University-level courses
  • Multiple Online degree programs
Datacamp
Pros
  • Great user experience
  • Offers quality content
  • Very transparent with their pricing
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable

Syntax for flex-wrap

To use the flex-wrap property, you need to define one of the three available values:

flex wrap: value;

See all the values explained in the table below.

Value Syntax Meaning
nowrap flex-wrap: nowrap; The default value. All the items are placed in one value, even if they don't fit within the container borders
wrap flex-wrap: wrap; The items are wrapped in several lines to fit within the container borders.
The direction depends on the value of flex-direction
wrap-reverse flex-wrap: wrap-reserve; The items are wrapped in several lines to fit within the container borders.
The direction is opposite to the value of flex-direction

Browser support

Browser image
Chrome
29+
Browser image
Edge
12+
Browser image
Firefox
28+
Browser image
IE
11+
Browser image
Opera
17+
Browser image
Safari
9+

Mobile browser support

Browser image
Chrome
29+
Browser image
Firefox
52+
Browser image
Opera
18+
Browser image
Safari
9+

Latest Udacity Coupon Found:

Verified STAFF PICK

75% OFF COURSES

Udacity Black Friday Offer

The best time to save on Udacity courses is now - follow this coupon to access a 75% Udacity Black Friday discount & enjoy learning at a very low cost!

Expiration date: 18/01/2021
3176 People Used
Only 97 Left
Rating
5.0