layout with flexbox

57
Flexbox Layouts A proper layout tool for the web… Finally!

Upload: the-level-consulting-ltd

Post on 02-Jul-2015

413 views

Category:

Design


5 download

DESCRIPTION

Finally a standard layout tool built for the internet.

TRANSCRIPT

Page 1: Layout with flexbox

Flexbox LayoutsA proper layout tool for the web… Finally!

Page 2: Layout with flexbox

HTML layouts before

display

Page 3: Layout with flexbox

HTML layouts before

displayblock | inline | inline-block | table | inline-table

Page 4: Layout with flexbox

HTML layouts before

position

Page 5: Layout with flexbox

HTML layouts before

positionrelative | absolute | fixed | static

Page 6: Layout with flexbox

HTML layouts before

float

Page 7: Layout with flexbox

HTML layouts before

floatleft | right | none

Page 8: Layout with flexbox

HTML layouts before

floatleft | right | none

clear

Page 9: Layout with flexbox

HTML layouts before

floatleft | right | none

clear

left | right | both | none

Page 10: Layout with flexbox

HTML layouts with Flexbox

Page 11: Layout with flexbox

HTML layouts with Flexboxflex container

Page 12: Layout with flexbox

HTML layouts with Flexboxflex container

display: flex | inline-flex

Page 13: Layout with flexbox

HTML layouts with Flexboxflex container

flex items

Page 14: Layout with flexbox

Flex Containerflex-direction

vertical horizontal

Page 15: Layout with flexbox

Flex Containerflex-wrap

wrap no-wrap

Page 16: Layout with flexbox

Flex Containerjustify-content: flex-start

Page 17: Layout with flexbox

Flex Containerjustify-content: flex-end

Page 18: Layout with flexbox

Flex Containerjustify-content: center

Page 19: Layout with flexbox

Flex Containerjustify-content: space-between

Page 20: Layout with flexbox

Flex Containerjustify-content: space-around

Page 21: Layout with flexbox

Flex Containeralign-items: flex-start

Page 22: Layout with flexbox

Flex Containeralign-items: flex-end

Page 23: Layout with flexbox

Flex Containeralign-items: center

Page 24: Layout with flexbox

Flex Containeralign-items: stretch

Page 25: Layout with flexbox

Flex Containeralign-items: baseline

hola hi hey howdy

Page 26: Layout with flexbox

Flex Container

align-content: flex-start

Page 27: Layout with flexbox

Flex Container

align-content: flex-end

Page 28: Layout with flexbox

Flex Container

align-content: center

Page 29: Layout with flexbox

Flex Container

align-content: stretch

Page 30: Layout with flexbox

Flex Container

align-content: space-between

Page 31: Layout with flexbox

Flex Container

align-content: space-around

Page 32: Layout with flexbox

Flex Items

order: 1

Page 33: Layout with flexbox

Flex Items

order: 2

Page 34: Layout with flexbox

Flex Items

order: 3

Page 35: Layout with flexbox

Flex Items

flex-grow: 1

Page 36: Layout with flexbox

Flex Items

flex-grow: 1

Page 37: Layout with flexbox

Flex Items

flex-grow: 1

Page 38: Layout with flexbox

Flex Items

flex-grow: 1

Page 39: Layout with flexbox

Flex Items

flex-grow: 2

Page 40: Layout with flexbox

Flex Items

flex-grow: 1

Page 41: Layout with flexbox

Flex Itemsflex-shrink: 1

Page 42: Layout with flexbox

Flex Itemsflex-shrink: 2

Page 43: Layout with flexbox

Flex Itemsflex-shrink: 1

Page 44: Layout with flexbox

Flex Itemsflex-basis: 20em

Page 45: Layout with flexbox

Flex Itemsflex: 2 1 50em

Page 46: Layout with flexbox

Flex Itemsflex: 2 1 50em

flex-grow

Page 47: Layout with flexbox

Flex Itemsflex: 2 1 50em

flex-shrink

Page 48: Layout with flexbox

Flex Itemsflex: 2 1 50em

flex-basis

Page 49: Layout with flexbox

Flex Items

align-self: flex-start

align-self: flex-end

Page 50: Layout with flexbox

Internet Explorer 9 and below…

Page 51: Layout with flexbox

Internet Explorer 9 and below…

Canada: 7.5%

rapidly shrinking

Page 52: Layout with flexbox
Page 53: Layout with flexbox

So what do we do now?

Page 54: Layout with flexbox

So what do we do now?pureCSS grid module

uses inline-block for <= IE9<div class="pure-g"> <div class="pure-u-1-3"><p>Thirds</p></div> <div class="pure-u-1-3"><p>Thirds</p></div> <div class="pure-u-1-3"><p>Thirds</p></div> </div>

Works very well if you know how many

columns

Page 55: Layout with flexbox

So what do we do now?pureCSS grid module

uses inline-block for <= IE9

re-order with javascriptjQuery insertAfter()

<div class=“order-3”><div class=“order-1”><div class=“order-2”>

<div class="pure-g"> <div class="pure-u-1-3"><p>Thirds</p></div> <div class="pure-u-1-3"><p>Thirds</p></div> <div class="pure-u-1-3"><p>Thirds</p></div> </div>

<div class=“order-3”>

$(window).resize(function() { if ($(window).width() < 960) { $(“.order-3”).insertAfter( $(“.order-2”) );

Page 56: Layout with flexbox

So what do we do now?

a { display: -webkit-box; display: -webkit-flex; display: -moz-box; display: -ms-flexbox; display: flex }

a { display: flex; }

Autoprefixer post-processor

Page 57: Layout with flexbox

Holy Grail Layoutheader, footer, three columns

• Has a fluid center with fixed-width sidebars • Center column should appear first in the HTML • Columns should be the same height • Minimal markup • The footer should "stick" to the bottom of the page when content is sparse

http://codepen.io/adamskye/pen/OPJKEP