Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Flexbox Rocks - ConvergeSE 2016

Jeremy Frank
April 15, 2016
130

Flexbox Rocks - ConvergeSE 2016

Jeremy Frank

April 15, 2016
Tweet

Transcript

  1. ๏ Tables ๏ CSS Block Layout (with floats) ๏ CSS

    Inline Layout (with display inline-block) LAYOUT HISTORY
  2. ๏ Tables ๏ CSS Block Layout (with floats) ๏ CSS

    Inline Layout (with display inline-block) ๏ CSS Table Layout LAYOUT HISTORY
  3. The Flexible Box Layout Module (e.g. Flexbox) aims at providing

    a more efficient way to lay out, align and distribute space among items in a container, even when their size is unknown and/or dynamic.
  4. ๏ Alignment ๏ Justification ๏ Ordering ๏ Distribution of Available

    Space FLEXBOX HELPS WITH ๏ Equal Heights ๏ Sticky Footers ๏ Fluid Inputs with Prepended/ Appended Add-ons ๏ Grid Systems ๏ Vertical Centering EASY WITH FLEXBOX
  5. Flex Container Flex Item Flex Item Flex Item Main Axis

    Cross Axis Cross Start Cross End Main End Main Start Main Size Cross Size
  6. ๏ flex-direction ๏ flex-wrap ๏ flex-flow ๏ justify-content ๏ align-items

    ๏ align-content FLEX CONTAINER PROPERTIES ๏ align-self ๏ order ๏ flex-grow ๏ flex-shrink ๏ flex-basis ๏ flex FLEX ITEM PROPERTIES
  7. flex-wrap nowrap wrap B A C D E B A

    C E D wrap-reverse E B A C D
  8. order B A C E D F 1 99 99

    99 99 99 -1 0 0 0 0 0
  9. order B A C E D F 1 2 3

    99 99 99 -3 -2 -1 0 0 0
  10. .box { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex;

    -webkit-box-orient: vertical; -webkit-box-direction: normal; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; -webkit-box-pack: center; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -webkit-align-items: center; -ms-flex-align: center; align-items: center; } Autoprefixer .box { display: flex; flex-direction: column; justify-content: center; align-items: center; }