Flexbox – Flow control in flexbox – Video tutorial



Flexbox – Flow control in flexbox – Video tutorial

0 1


flexbox-slides

Slides for a flexbox course

On Github jayway / flexbox-slides

Flexbox

Slides online

http://jayway.github.io/flexbox-slides

What is flexbox?

  • Defined via the display property in CSS
  • Enables layout models that previously was impossible or at least very hard to achive

Browser support

  • Is supported by (almost) all modern browsers
    • Firefox 28+
    • Chrome 29+
    • Internet Explorer 11+
    • Opera 17+
  • Safari 6.1+ requires -webkit prefix

The flexbox model

Start using flexbox

.flex-container {
  display: flex | inline-flex;
}
.flex-item {
  flex-grow: 0;
  flex-shrink: 1;
  flex-basis: auto;
}

Flow control in flexbox

.flex-container {
  flex-direction: row | row-reverse | column | column-reverse;
  flex-wrap: no-wrap | wrap | wrap-reverse;
}
.flex-container {
  flex-flow: row wrap;
}

flex-direction

.flex-container {
  flex-direction: row;
}
.flex-container {
  flex-direction: row-reverse;
}
.flex-container {
  flex-direction: column;
}
.flex-container {
  flex-direction: column-reverse;
}

flex-wrap

.flex-container {
  flex-direction: row;
  flex-wrap: nowrap;
}
.flex-container {
  flex-direction: row;
  flex-wrap: wrap-reverse;
}
.flex-container {
  flex-direction: column;
  flex-wrap: wrap;
}
.flex-container {
  flex-direction: row;
  flex-wrap: wrap;
}

Video tutorial

1 - The basics

2 - Grow and shrink elements

3 - Odds and ends

Lab

Layouts for large and small screens

Instructions

  • Build this layout with as few elements as possible
  • Choose a suitable break point for the small screen layout
  • No height properties are to be used (use only the flexbox model)
  • The layout should cover at least the height of the browser viewport

Lab resources

http://jayway.github.io/flexbox-course/flexbox-lab.zip

A few good links