INTRO

INTRO

New

Intro to the Designer

Intro to the Designer

New

2:48

Intro to HTML & CSS

Intro to HTML & CSS

New

3:38

WEB STRUCTURE

WEB STRUCTURE

New

The Box Model

The Box Model

New

1:54

Element Hierarchy

Element Hierarchy

New

3:57

Navigator

Navigator

New

2:45

Element Basics

Element Basics

New

Element Panel

Element Panel

New

1:49

Section

Section

New

4:14

Container

Container

New

2:44

Columns

Columns

New

2:22

Div Block

Div Block

New

3:37

Components

Components

New

Intro to Forms

Intro to Forms

New

4:55

Navbar

Navbar

New

9:38

Slider

Slider

New

4:56

Symbols

Symbols

New

3:47

Styling Basics

Styling Basics

New

Intro to Style Panel

Intro to Style Panel

New

3:15

HTML Tags

HTML Tags

New

3:59

Classes

Classes

New

2:46

Combo Classes

Combo Classes

New

4:05

States

States

New

2:47

Layout

Layout

New

Intro to Web Layout

Intro to Web Layout

New

2:27

Padding & Margin

Padding & Margin

New

2:48

Display Settings

Display Settings

New

2:54

Intro to Flexbox

Intro to Flexbox

New

2:27

Grid layouts overview

Grid layouts overview

New

4:18

Positioning Overview

Positioning Overview

New

1:48

Responsive Design

Responsive Design

New

Intro to Responsive Design

Intro to Responsive Design

New

2:21

Intro to Breakpoints

Intro to Breakpoints

New

INTERACTIONS CORE CONCEPTS

INTERACTIONS CORE CONCEPTS

New

Triggers & animations

Triggers & animations

New

4:31

CMS & Dynamic Content

CMS & Dynamic Content

New

Intro to Dynamic Content

Intro to Dynamic Content

New

1:36

Intro to Webflow CMS

Intro to Webflow CMS

New

2:02

CMS Collections

CMS Collections

New

2:05

Collection List

Collection List

New

3:33

Filtering Collection Lists

Filtering Collection Lists

New

2:47

Collection Page

Collection Page

New

3:01

Using the Editor

Using the Editor

New

2:22

CMS Collection Fields

CMS Collection Fields

New

Plain Text Field

Plain Text Field

New

0:51

Rich Text Field

Rich Text Field

New

1:16

Image Field

Image Field

New

1:24

Switch Field

Switch Field

New

0:58

Reference Field

Reference Field

New

1:11

Multi-reference Field

Multi-reference Field

New

2:31

new course
CSS grid landing page tutorial (36min)

Lesson info

Lesson info

Flexbox (also know as flex or flexible box layout) is a very powerful layout tool that gives you precise alignment and stacking control for all the contents inside an element. It solves many layout problems that designers have been struggling with for a very long time. Here we’ll be covering some of the important concepts you’ll need to understand to master flexbox: 

  • Enabling flex on an element
  • Flex layout settings
  • Flex item settings

We created a flexbox game to help you learn flexbox even faster. Also check out our tutorials for centering elements with flexbox and building equal-height layouts with flexbox.

Explore this project

Want to dig into the project featured in this video and see how everything is put together? We've included the full project we used when making this lesson, and we've shared the link right under this very paragraph.

View and clone this projectDownload lesson assets
Clone this projectDownload project assets

Transcript

Flexbox — which we'll often refer to as "flex", "flexible box layout", or "magic" — is an extremely powerful layout tool which gives us precise control over elements in a box. This lesson is an intro to Flexbox, which is why we've named it Intro to Flexbox. Instead of going step-by-step right through the detailed Flexbox spec, we're going to simply cover the relationship between flex containers (the parents) and flex items (the children).

Let's talk containers. A flex container is the parent element. Flexbox starts when you create a flex container out of something. With this section selected, let's switch our display setting to flex. And that's it. We've created a flex container.

This unlocks all our flex options underneath. If we have multiple items in our flex container, we can choose if we want our layout to be horizontal or vertical. And of course, we have options for justification and alignment of the items inside our container.

We can also reverse the items in our layout, or even wrap these items if their total width exceeds the inner boundary of the container.

But that's the flex container.

Let's talk about the flex items (the children).

Any of the items directly inside (any direct children of the flex container) are referred to as flex items. We can select these and configure layout options which can add to or even override settings we set on the flex container. We can do this on various elements — but keep in mind that in CSS, layout is part of styling. So we can use classes to control how various elements are to behave.

Now something that's really important to note: properties we set on flex containers? They only affect their direct children.

So here, we have a section with a div block inside. Nothing special on our div block. It's just a div block. It's holding some content. And if we select our section (which is serving as the flex container), we can see that we've set our flex layout controls. The div block is being centered. But notice how as we adjust our layout options, the children of the div block remain unaffected.

Now we could select the div block and make it a flex container, too, but the point is that flex containers — in this case the section — the controls we set on flex containers only affect their direct children. Not their children's children.

So. Essentially, Flexbox layouts are achieved between two types of elements: a flex container (the parent element) and a flex item (the child element). You can have many flex items inside your flex container, and you can use a div or any kind of container to nest and group other elements to sort them however you'd like.