From the course: Responsive Layout
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Wrapping
- [Instructor] Next we're going to talk about flex-wrap. The flex-wrap property determines what happens when there isn't space for all the flex items. Do thy squish and stay on one line or wrap onto multiple lines? We're going to need our flex items to be a bit wider for this example, so we're going to give them a width in the CSS. On line 14, for the class item , I am going to give it a width of 200 pixels. Now we have our five flex items, a bit wider, with a horizontal main axis. For flex-wrap, the default is no wrap. I'm gonna go back to the container element in line 13, and do flex-wrap: nowrap. Note that there is no hyphen in nowrap, which is a little different, because many other properties in Flexbox have hyphens in their values. With this default, everything is going to stay on one line. In a wider viewport like this, they all fit, but as I make the viewport narrower, they won't all fit, with their defined width of 200 pixels, but as flex items, the browser will decrease their…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Defining a flexbox container1m 53s
-
(Locked)
Direction3m 36s
-
(Locked)
Wrapping2m 30s
-
(Locked)
Ordering flex items1m 28s
-
(Locked)
Flexbox alignment overview1m 39s
-
(Locked)
Aligning items on main axis3m 16s
-
(Locked)
Aligning items on cross axis3m 35s
-
(Locked)
Aligning lines on cross axis3m 15s
-
(Locked)
Aligning individual flex items1m 38s
-
(Locked)
Distributing space to flex items4m 43s
-
(Locked)
Challenge: Floats to flexbox1m 21s
-
(Locked)
Solution: Floats to flexbox8m 17s
-
-
-