what the flexbox? an intro to flexbox

33
An Intro to Flexbox What the Flexbox? Lauren Pittenger @laurenpittenger 1

Upload: lauren-pittenger

Post on 22-Jan-2018

113 views

Category:

Design


5 download

TRANSCRIPT

Page 1: What The Flexbox? An Intro to Flexbox

An Intro to FlexboxWhat the Flexbox?

Lauren Pittenger@laurenpittenger1

Page 2: What The Flexbox? An Intro to Flexbox

What is flexbox?A layout mode which positionselements on a page in a waythat is predictable and flexible. Doesn't use floats and marginsdon't collapse. Many designers find it easierto use.

2

Page 3: What The Flexbox? An Intro to Flexbox

http://codepen.io/lepittenger/pen/vyjeER/

3

Page 4: What The Flexbox? An Intro to Flexbox

http://codepen.io/lepittenger/full/MbGEaw/

4

Page 5: What The Flexbox? An Intro to Flexbox

Flexbox Layout Mode

5

Page 6: What The Flexbox? An Intro to Flexbox

Flex Container

display: flex

6

Page 7: What The Flexbox? An Intro to Flexbox

Flex Items

7

Page 8: What The Flexbox? An Intro to Flexbox

Main AxisThe main axis is the axis along which the

flex items follow each other.

8

Page 9: What The Flexbox? An Intro to Flexbox

Cross AxisThe cross axis is the axis perpendicular to

the main axis.

9

Page 10: What The Flexbox? An Intro to Flexbox

Main & Cross Sizes

10

Page 11: What The Flexbox? An Intro to Flexbox

Flex Container Properties

Flex Direction: RowDefines the main and cross axis and controls how flex items are placed in container.

flex-direction: row | row-reverse | column | column-reverse

11

Page 12: What The Flexbox? An Intro to Flexbox

Flex Container Properties

Flex Direction: Row ReverseDefines the main and cross axis and controls how flex items are placed in container.

flex-direction: row | row-reverse | column | column-reverse

12

Page 13: What The Flexbox? An Intro to Flexbox

Flex Container Properties

Flex Direction: ColumnDefines the main and cross axis and controls how flex items are placed in container.

flex-direction: row | row-reverse | column | column-reverse

13

Page 14: What The Flexbox? An Intro to Flexbox

Flex Container Properties

Flex Direction: Column ReverseDefines the main and cross axis and controls how flex items are placed in container.

flex-direction: row | row-reverse | column | column-reverse

14

Page 15: What The Flexbox? An Intro to Flexbox

Flexbox Layout Mode

15

Page 16: What The Flexbox? An Intro to Flexbox

Flex Container Properties

Justify Content: Flex StartDefines how space is distributed along the main axis.

justify-content: flex-start | flex-end | center | space-between | space-around

16

Page 17: What The Flexbox? An Intro to Flexbox

Flex Container Properties

Justify Content: Flex EndDefines how space is distributed along the main axis.

justify-content: flex-start | flex-end | center | space-between | space-around

17

Page 18: What The Flexbox? An Intro to Flexbox

Flex Container Properties

Justify Content: CenterDefines how space is distributed along the main axis.

justify-content: flex-start | flex-end | center | space-between | space-around

18

Page 19: What The Flexbox? An Intro to Flexbox

Flex Container Properties

Justify Content: Space BetweenDefines how space is distributed along the main axis.

justify-content: flex-start | flex-end | center | space-between | space-around

19

Page 20: What The Flexbox? An Intro to Flexbox

Flex Container Properties

Justify Content: Space AroundDefines how space is distributed along the main axis.

justify-content: flex-start | flex-end | center | space-between | space-around

20

Page 21: What The Flexbox? An Intro to Flexbox

Flex Container Properties

Flex Wrap: NowrapSpecifies whether items on a line should be forced onto one line or flow onto a next line.

flex-wrap: nowrap | wrap | wrap-reverse

21

Page 22: What The Flexbox? An Intro to Flexbox

Flex Container Properties

Flex Wrap: WrapSpecifies whether items on a line should be forced onto one line or flow onto a next line.

flex-wrap: nowrap | wrap | wrap-reverse

22

Page 23: What The Flexbox? An Intro to Flexbox

Flex Container Properties

Flex Wrap: Wrap ReverseSpecifies whether items on a line should be forced onto one line or flow onto a next line.

flex-wrap: nowrap | wrap | wrap-reverse

23

Page 24: What The Flexbox? An Intro to Flexbox

Align Items: Flex Start

Flex Container Properties

Defines how space is distributed along the cross axis.

align-items: flex-start | flex-end | center | baseline | stretch

24

Page 25: What The Flexbox? An Intro to Flexbox

Flex Container Properties

Align Items: CenterDefines how space is distributed along the cross axis.

align-items: flex-start | flex-end | center | baseline | stretch

25

Page 26: What The Flexbox? An Intro to Flexbox

Flex Container Properties

Align Items: BaselineDefines how space is distributed along the cross axis.

align-items: flex-start | flex-end | center | baseline | stretch

26

Page 27: What The Flexbox? An Intro to Flexbox

Flex Container Properties

Align Items: StretchDefines how space is distributed along the cross axis.

align-items: flex-start | flex-end | center | baseline | stretch

27

Page 28: What The Flexbox? An Intro to Flexbox

Align Content

stretch space-between space-around

flex-start flex-end center

Aligns a flex container’s lines on the cross axis when there is extra space along thecross axis. It has no effect on a single line of flex items.

align-content: flex-start | flex-end | center | space-between | space-around | stretch

28

Page 29: What The Flexbox? An Intro to Flexbox

Align Self

Flex Item Properties

Overrides align-items value. Ignored if flex item’s cross-axis margin is set to auto.

align-self: auto | flex-start | flex-end | center | baseline | stretch

29

Page 30: What The Flexbox? An Intro to Flexbox

http://codepen.io/lepittenger/details/pNONWY/30

Page 31: What The Flexbox? An Intro to Flexbox

http://codepen.io/lepittenger/details/pNONWY/31

Page 32: What The Flexbox? An Intro to Flexbox

Order

Flex item Properties

Specifies order items should appear within the flex container. Laid out in ascendingorder. Elements with the same order appear in the order of the source code.

order: <integer>

32