From the course: CSS Layouts: From Float to Flexbox and Grid
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Exercise: Build a layout with Flexbox, part 1 - CSS Tutorial
From the course: CSS Layouts: From Float to Flexbox and Grid
Exercise: Build a layout with Flexbox, part 1
- [Speaker] Since we're using the same HTML for all three layout exercises, let's start by switching to the flexbox.css file. This gives us a fresh place to start with just the base presentational styles and no float CSS from the previous layout exercise. Now we can decide which element we can make our flex container. Since the container Div wraps all of the content, we'll use this as the flex container. Let's close the floats.css file and open the flexbox.css file instead. The first thing we'll do is initiate the flexbox layout. In the existing container block. Let's add display set to flex. We also want the items to wrap, so we can style the header and footer on their own row and the nav, main, and side as another row. So we could use the flex-wrap property set to wrap. Then save the file and see how it looks in the browser. By default, the width of a flex item is equal to its content and they line up side-by-side in a…
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
-
-
-
-
-
Getting started with Flexbox2m 41s
-
(Locked)
Orientation with flex-direction and flex-wrap2m 37s
-
(Locked)
Flexible sizing5m 18s
-
(Locked)
Sizing multiple flex items1m 18s
-
(Locked)
The order property54s
-
(Locked)
Nesting flex containers3m 40s
-
(Locked)
Exercise: Build a layout with Flexbox, part 16m 29s
-
(Locked)
Exercise: Build a layout with Flexbox, part 23m 16s
-
-
-