SlideShare une entreprise Scribd logo
1  sur  108
Télécharger pour lire hors ligne
Flexbox 
Zoe Mickley Gillenwater @zomigiCSS Summit
July 2016
TODAY
USING
I work for
Psst…you can too: www.workingatbooking.com
My portfolio site from 2000
My portfolio site from 2000
tables
positioning
floats
inline-block
table-cell
flexbox
grid
 multi-column
exclusions
shapes
regions
flexbox
when
what
flexbox
how
Deciding when to use and not use flexbox
WHEN
¨ 1.
What browsers do I need to
support?
Don’t ask yourself this—it’s irrelevant here
(IMO)
Flexbox has 96.8% coverage worldwide
We support IE 7-9 at Booking, but still use flexbox as
progressive enhancement.
Do I want to create a layout in
1 dimension (row OR column)
or 2 dimensions?
Hat-tip to Rachel Andrew:
https://rachelandrew.co.uk/archives/2016/03/30/should-i-use-grid-or-flexbox/
Flexbox is not a grid
¨  Not meant for or great at whole page layout
¨  Flex items only care about space in their
own row/column
¨  They don’t care about lining up in the other
dimension
Demo by Rachel Andrew: http://codepen.io/rachelandrew/pen/YqqdXL
Flexbox is best for:
¨  UI components
¨  Simple whole page layouts (not grid-based)
¨  Enhancing a complex layout’s alignment,
spacing, etc. (not controlling placement)
Do I need my content to
dictate sizing and placement,
or do I need to control these?
Content determines
boxes’ size and
placement
(Mega-useful when
content is unknown and
variable, or readability is
a top priority.)
Structure determines
content’s size and
placement
(P.S. Flexbox can do this
too, if you want. It’s just
the reverse that doesn’t
work so well.)
Flexbox Grids
Does flexbox offer me anything
I can’t already get
from an existing layout method?
New things flexbox offers
¨  Content-driven, unit-less sizes
¨  Content-driven, media-query-less layout changes
¨  Mixed-unit layouts
¨  Equal-height columns
¨  Vertical centering and other alignments
¨  Spacing out or stretching items to fill unknown width/height
¨  Combining content wrapping and block wrapping
¨  Pinning items without overlaps
¨  Visual order different than HTML/reading order
Components flexbox can enhance and
UI/UX problems it can help you solve
WHAT
¨ 2.
content-driven, unit-less sizes
How big do I make this thing?
%
em/rem
vw/vh
Relative units of measurement
are your best guess at the
ideal, but they’re still a guess.
Flexbox gets us closer to the
ideal, because it lets us design
without units.
Example: a responsive form
from http://jobs.theguardian.com/
My copy of that form
Same floats, same percentage widths
The trouble with explicit sizing
Since the select and button are sized by a
percentage, not sized automatically by their
content, this can happen:
Box too small for its content Box too big for its content
Use the flex property instead
Tells browser starting size (including content
size) and whether item can grow or shrink
width: 33.333%
flex: auto
Fill up remaining space
width: 16.666%
flex: none
Size to content exactly
Form fields are a pain in the butt
The fields and button don’t all match each
other exactly in height
Fix alignment with flexbox
Turn each field wrapper into flex container so
field inside will stretch to match height of line:
.flexbox .jobs-form_field-wrapper {
display: flex;
align-items: stretch; /* default */
width: auto;
}
Fields misaligned without flexbox Fields match height due to align-items
Smarter sizing
Non-flexbox
Flexbox enhanced
Content-driven sizing on Booking.com
Last year’s sidebar searchbox design, with
fixed-width select fields
Content-driven sizing on Booking.com
Non-flexbox Flexbox enhanced
Content-driven sizing on Booking.com
.sb-dates {
display: flex;
}
.sb-dates__icon {
flex: 0 0 23px;
}
.sb-dates__select-day {
flex: 1 0 auto;
margin: 0 6px;
}
.sb-dates__select-month {
flex: 1 1 auto;
}
flex container
main axis
flex items
Defining the flex property
flex-grow
how much flex
item will grow
relative to
other items if
extra space is
available
(proportion
of extra space
that it gets)
flex-shrink
how much item
will shrink
relative to others
if there is not
enough space
(proportion of
overflow that
gets shaved off)
flex-basis
the initial
starting size
before free
space is
distributed
(any standard
width/height
value, including
auto)
Translating the flex property
.sb-dates {
display: flex;
}
.sb-dates__icon {
flex: 0 0 23px;
}
.sb-dates__select-day {
flex: 1 0 auto;
margin: 0 6px;
}
.sb-dates__select-month {
flex: 1 1 auto;
}
Start out 23px wide, and don’t grow
or shrink further
Start out sized to your content, then
grow with 1 share of any extra space
available, but don’t ever shrink
Start out sized to your content, then
grow with 1 share of extra space, but
if there’s an overflow shrink
Mixed-unit layout is easier with
calc(), but not even it can do:
calc(100% - 23px - the width of
the day field in Greek)
Taking advantage of variable space
Task: add a
message about
low availability
of the room
price shown:
“We have only X
left on our site!”
How about right here
in this lovely big gap?
Taking advantage of variable space
Problem: the gap
is not always big
enough to hold a
sentence of text
Taking advantage of variable space
Solution: use
flexbox to place
text beside price
when space
allows; otherwise,
it can wrap below
price
Progressive enhancement
Non-flexbox Flexbox enhanced
Content-driven layout change
2 columns 3 columns
RWD content-driven layout change
Narrow: 1 column Wide: 2 columns
RWD content-driven layout change
.article-header {
display: flex;
flex-flow: row wrap;
margin-left: -20px;
}
.article-header-image {
flex: 1 1 320px;
padding-left: 20px;
}
When 320px + 20em can fit together, layout shifts
to 1 row/2 columns
.article-header-text {
flex: 1 1 20em;
padding-left: 20px;
}
Layout change without media query
1.  Let the blocks wrap and stack when needed:
.article-header {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
/* default */
Layout change without media query
2.  Size the blocks to control their wrapping
point:
.article-header-image {
flex: 1 1 320px;
padding-left: 20px;
}
.article-header-text {
flex: 1 1 20em;
padding-left: 20px;
}
Stretching to fill unknown width/height
flex: 1 1 auto
align-content:
space-between
Improved wrapping in RWD layout
With float or text-align With flex or justify-content
Flexbox is great for spacing
and aligning stuff, especially
shifting content in RWD.
Demo: full-width nav bar
¨  All links on same line
¨  First link flush left, last link flush right
¨  Equal spaces between all links
Trying display:table-cell
J All links on same line
J First link flush left, last link flush right
L Equal spaces between all links
Spacing with table-layout:fixed
Starter centered nav bar, no flexbox
.menu-list {
margin: 0;
padding: 0;
list-style: none;
text-align: center;
}
http://codepen.io/zomigi/pen/vKjbbY/
.menu-list-item {
display: inline-block;
padding: 16px 32px;
}
Enhanced to full-width with flexbox
.menu-list {
display: flex;
justify-content: space-between; /* equally spaces items across width */
margin: 0;
padding: 0;
list-style: none;
text-align: center; /* fallback */
}
.menu-list-item {
display: inline-block; /* fallback */
padding: 0 .5em; /* fallback */
}
Combine with inline-block
Non-flexbox
fallback version
Flexbox version
This works vertically too.
Demo: full-height menu
Demo: full-height menu
.menu-list {
display: flex;
flex-direction: column;
justify-content: space-between;
}
.menu-list-item {
height: 100%;
display: flex;
align-items: center;
}
.menu-list {
display: flex;
flex-direction: column;
}
.menu-list-item {
flex: 1 0 auto;
display: flex;
align-items: center;
}
justify-content version flex version
Demo: full-height menu
.menu-list {
display: flex;
flex-direction: column;
justify-content: space-between;
}
.menu-list-item {
height: 100%;
display: flex;
align-items: center;
}
.menu-list {
display: flex;
flex-direction: column;
}
.menu-list-item {
flex: 1 0 auto;
display: flex;
align-items: center;
}
justify-content version flex version
Flexbox can also enhance
visual ordering.
order
integer to specify flow order of flex items
0
 0
 0
default source order 0
 0
1
0
 0
re-ordered 0
 0
0
 0
-1
re-ordered 0
 0
2
1
0
re-ordered 1
0
Reorder for good, not evil.
Demo: moving a photo on mobile
Demo: moving a photo on mobile
Desktop: HTML order (no flexbox)Mobile: reordered
Use flexbox order in mobile styles
.recipe {
display: flex;
flex-direction: column;
}
.recipe figure {
order: -1; /* before all items with default order: 0 */
}
.recipe figure img {
width: 100%;
}
Turn off flexbox in desktop styles
@media screen and (min-width:800px) {
.recipe {
display: block; /* turn off flexbox */
}
.recipe figure {
float: right;
width: 55%;
}
}
Demo: moving a photo on mobile
Flexbox enhanced Non-flexbox
Reordering on The Guardian
12 3
4 56
flex-direction: row-reverse
flex-direction: row-reverse
1
2
3
4
5
6
These examples don’t look wrong
or broken without flexbox.
Flexbox just enhances their sizing
and spacing to look better.
Step-by-step process for adding flexbox
to your UI components effectively
HOW
¨ 3.
Don’t freak out
Decide whether flexbox is the
right tool for the job
Decide which versions of
flexbox to support
standard, 2011/2012, and/or 2009
Browser support approaches to choose
¨  Use only the non-prefixed, standard syntax
¨  … plus browser-prefixed versions of
standard syntax
¨  … plus -ms- prefixed 2011/2012 syntax
¨  … plus -webkit- prefixed 2009 syntax
http://caniuse.com/#feat=flexbox
I recommend you skip the ‘09 syntax
¨  It’s slower to render than current syntax*
¨  Doesn’t support wrapping
¨  Its browsers have small market share
¨  If using flexbox for progressive
enhancement, its browsers can get same
fallback given to non-supporting browsers
* http://updates.html5rocks.com/2013/10/Flexbox-layout-isn-t-slow
Let tools add browser variants for you
Which variants do you want? Best tool to handle that
All the things! Autoprefixer
Bourbon (Sass)
Only the standard syntax,
with and without prefixes
Compass (Sass)
Some other combination
(such as everything except 2009)
Sass or LESS mixins, such as
https://github.com/mastastealth/
sass-flex-mixin
Add Modernizr as needed with flexbox
Flexbox and fallback styles can often co-
exist, but sometimes need to isolate them
http://zomigi.com/blog/using-modernizr-with-flexbox/
Or use @supports
.gallery-item {
display: inline-block;
}
@supports (flex-wrap: wrap) {
.gallery {
display: flex;
flex-wrap: wrap;
}
}
https://developer.mozilla.org/en-US/docs/Web/CSS/@supports
But IE 10-11, which do
support flexbox but
don’t support
@supports, won’t get
these styles
Choose and add appropriate
starter/fallback layout CSS
Things to consider
Do I need content blocks to wrap? not table-cell
Do I want to prevent blocks from wrapping? floats, inline-block, but
table-cell best
Do I need content-driven sizes? floats, but table-cell or
inline-block best
Do I need vertical alignment? inline-block, table-cell
Do I need horizontal alignment? floats, table-cell, inline-
block only with preset
sizes
Pick your starter layout CSS
¨  Floats
¨  table-cell
¨  inline-block
¨  Absolute positioning
Flexbox will override: Flexbox will not override:
Just use whatever you normally would;
flexbox plays nicely with most of them.
A real example of this process
Split left-right layout
Task: lay out review score
and price, on opposite
sides of same line
Needs:
¨  content-driven sizing
¨  horizontal alignment
¨  wrapping
score price or
“sold out”
Adding the starter CSS
.iw_mini_review_score_wrapper {
float: left;
}
.iw_mini_price_wrapper {
float: right;
}
Start adding flexbox!
Decide whether entire
component needs to be
block or inline-block
display:flex or inline-flex
Creating the block flex container
.iw_mini_details_wrapper {
display: flex;
}
.iw_mini_review_score_wrapper {
float: left;
}
.iw_mini_price_wrapper {
float: right;
}
Flex container sits
on a new row below,
like a block element
Decide flow of flex items
Things to consider
Lay out horizontally or vertically? flex-direction:row or
column
Allow boxes to wrap? flex-wrap:wrap,
wrap-reverse or nowrap
Order different than source? order values;
flex-direction:
row-reverse or
column-reverse
Allowing wrapping
.iw_mini_details_wrapper {
display: flex;
flex-wrap: wrap;
}
.iw_mini_review_score_wrapper {
float: left;
}
.iw_mini_price_wrapper {
float: right;
}
Allows second block to
wrap down if needed
Decide which items can
grow to fill space,
shrink to avoid overflow,
or must stay at a certain size
Tips for setting flex values
¨  Write out full flex values, rather than
using single-digit and keyword values
¤  flex: 1 1 0% instead of flex: 1
¤  Hidden default values can lead to mistakes
¤  Avoids IE 10-11 bugs
¨  Think about it backwards: first decide
flex-basis, then -shrink, then -grow
Tips for setting flex-basis values
¨  Acts like min-width when wrapping on
¨  If flex-wrap off and flex-shrink on,
browser can go smaller than flex-basis
¨  Be careful with flex-basis:0 when
wrapping
¨  Use flex-basis:auto whenever possible
Setting flex-shrink
¨  Always have at least 1 item per line that
can shrink (or wrap, or both)
Setting flex-grow
¨  Decide what to do with extra space
¤  Fill it up? (flex-grow: 1, 2, etc.)
¤  Leave it? (flex-grow: 0)
Setting flex values
.iw_mini_details_wrapper {
display: flex;
flex-wrap: wrap;
}
.iw_mini_review_score_wrapper {
float: left;
flex: 0 1 auto;
}
.iw_mini_price_wrapper {
float: right;
flex: 0 1 auto;
}
Size to content, shrink
smaller if you have to,
don’t grow bigger
(default value)
Decide how to align flex items
Main axis alignment
(horizontal when row,
vertical when column)
Cross axis alignment
(vertical when row,
horizontal when column)
(P.S. Also responsible for
equal-height columns)
justify-content align-items
Controlling alignment
.iw_mini_details_wrapper {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: baseline;
}
.iw_mini_review_score_wrapper {
float: left;
}
.iw_mini_price_wrapper {
float: right;
}
Moves first item to left,
last item to right
Improved wrapping
Non-flexbox Flexbox enhanced
Flexbox with float fallback
.iw_mini_details_wrapper {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: baseline;
}
.iw_mini_review_score_wrapper {
float: left;
}
.iw_mini_price_wrapper {
float: right;
}
Flexbox properties on
container override
floating automatically
in supporting browsers
Floating gets used by
old browsers
Test
Testing your flexbox
¨  Too Flexy bookmarklet for toggling
Modernizr flexbox classes:
http://chriswrightdesign.github.io/tooflexy/
¨  If reordering, check tabbing and screen
reading order to make sure it’s still logical
Fix bugs
Fixing browsers’ flexbox bugs
¨  Read explanations and workarounds by
Philip Walton:
https://github.com/philipwalton/flexbugs
¨  Let PostCSS fix some for you:
https://github.com/luisrudge/postcss-flexbugs-fixes
Summing up the process
1.  Decide whether to use flexbox and which browser
versions of it
2.  Choose and add starter layout CSS
3.  Choose and add flexbox CSS
1.  Block or inline-block container
2.  Flow
3.  Flex to control sizing
4.  Alignment
4.  Test and fix bugs
Flexbox is not for the future.
You can use flexbox today.
Thanks!
Zoe Mickley Gillenwater
@zomigi
design@zomigi.com
zomigi.com

Contenu connexe

Tendances

Flexbox: One Giant Leap for Web Layout (Breaking Development 2013)
Flexbox: One Giant Leap for Web Layout (Breaking Development 2013)Flexbox: One Giant Leap for Web Layout (Breaking Development 2013)
Flexbox: One Giant Leap for Web Layout (Breaking Development 2013)Stephen Hay
 
Flexbox and Grid Layout: How you will structure layouts tomorrow.
Flexbox and Grid Layout: How you will structure layouts tomorrow.Flexbox and Grid Layout: How you will structure layouts tomorrow.
Flexbox and Grid Layout: How you will structure layouts tomorrow.Diego Eis
 
Putting Flexbox into Practice (Fronteers)
Putting Flexbox into Practice (Fronteers)Putting Flexbox into Practice (Fronteers)
Putting Flexbox into Practice (Fronteers)Zoe Gillenwater
 
Understanding flex box CSS Day 2016
Understanding flex box CSS Day 2016Understanding flex box CSS Day 2016
Understanding flex box CSS Day 2016Davide Di Pumpo
 
Flexbox: One Giant Leap for Web Layout (GenerateConf 2013)
Flexbox: One Giant Leap for Web Layout (GenerateConf 2013)Flexbox: One Giant Leap for Web Layout (GenerateConf 2013)
Flexbox: One Giant Leap for Web Layout (GenerateConf 2013)Stephen Hay
 
Flexbox every developers dream
Flexbox every developers dreamFlexbox every developers dream
Flexbox every developers dream2019gracesmith
 

Tendances (8)

Flexbox: One Giant Leap for Web Layout (Breaking Development 2013)
Flexbox: One Giant Leap for Web Layout (Breaking Development 2013)Flexbox: One Giant Leap for Web Layout (Breaking Development 2013)
Flexbox: One Giant Leap for Web Layout (Breaking Development 2013)
 
The Power of CSS Flexbox
The Power of CSS FlexboxThe Power of CSS Flexbox
The Power of CSS Flexbox
 
Flexbox and Grid Layout: How you will structure layouts tomorrow.
Flexbox and Grid Layout: How you will structure layouts tomorrow.Flexbox and Grid Layout: How you will structure layouts tomorrow.
Flexbox and Grid Layout: How you will structure layouts tomorrow.
 
Putting Flexbox into Practice (Fronteers)
Putting Flexbox into Practice (Fronteers)Putting Flexbox into Practice (Fronteers)
Putting Flexbox into Practice (Fronteers)
 
Understanding flex box CSS Day 2016
Understanding flex box CSS Day 2016Understanding flex box CSS Day 2016
Understanding flex box CSS Day 2016
 
Flexbox: One Giant Leap for Web Layout (GenerateConf 2013)
Flexbox: One Giant Leap for Web Layout (GenerateConf 2013)Flexbox: One Giant Leap for Web Layout (GenerateConf 2013)
Flexbox: One Giant Leap for Web Layout (GenerateConf 2013)
 
Flexbox every developers dream
Flexbox every developers dreamFlexbox every developers dream
Flexbox every developers dream
 
Fewd week3 slides
Fewd week3 slidesFewd week3 slides
Fewd week3 slides
 

En vedette

Intro to Flexbox - A Magical CSS Property
Intro to Flexbox - A Magical CSS PropertyIntro to Flexbox - A Magical CSS Property
Intro to Flexbox - A Magical CSS PropertyAdam Soucie
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid LayoutRachel Andrew
 
CSS Lessons Learned the Hard Way (ConvergeSE)
CSS Lessons Learned the Hard Way (ConvergeSE)CSS Lessons Learned the Hard Way (ConvergeSE)
CSS Lessons Learned the Hard Way (ConvergeSE)Zoe Gillenwater
 
Таблицы Html
Таблицы HtmlТаблицы Html
Таблицы HtmlVasya Petrov
 
Uwe usability evaluation
Uwe usability evaluationUwe usability evaluation
Uwe usability evaluationLon Barfield
 
Joomla Request To Response
Joomla Request To ResponseJoomla Request To Response
Joomla Request To ResponseAmit Kumar Singh
 
Bdd and dsl как способ построения коммуникации на проекте
Bdd and dsl как способ построения коммуникации на проектеBdd and dsl как способ построения коммуникации на проекте
Bdd and dsl как способ построения коммуникации на проектеISsoft
 
Show vs. Tell in UX Design (Front in Amsterdam)
Show vs. Tell in UX Design (Front in Amsterdam)Show vs. Tell in UX Design (Front in Amsterdam)
Show vs. Tell in UX Design (Front in Amsterdam)Zoe Gillenwater
 
Пингвины из калининграда
Пингвины из калининградаПингвины из калининграда
Пингвины из калининградаAndrew Yashenko
 
решение основной проблемы Agile (scrum) проектов в контексте ba
решение основной проблемы Agile (scrum) проектов в контексте baрешение основной проблемы Agile (scrum) проектов в контексте ba
решение основной проблемы Agile (scrum) проектов в контексте baISsoft
 
Тестирование требований
Тестирование требованийТестирование требований
Тестирование требованийISsoft
 
17. основы css (cascading style sheets)
17. основы css (cascading style sheets)17. основы css (cascading style sheets)
17. основы css (cascading style sheets)Sergei Dubrov
 
Верстка_Лекция1
Верстка_Лекция1Верстка_Лекция1
Верстка_Лекция1itc73
 
6. таблицы и другие теги html
6. таблицы и другие теги html6. таблицы и другие теги html
6. таблицы и другие теги htmlSergei Dubrov
 
Images and Tables in HTML
Images and Tables in HTMLImages and Tables in HTML
Images and Tables in HTMLAarti P
 

En vedette (18)

CSS: Flexbox & Grid
CSS: Flexbox & GridCSS: Flexbox & Grid
CSS: Flexbox & Grid
 
Intro to Flexbox - A Magical CSS Property
Intro to Flexbox - A Magical CSS PropertyIntro to Flexbox - A Magical CSS Property
Intro to Flexbox - A Magical CSS Property
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid Layout
 
CSS Lessons Learned the Hard Way (ConvergeSE)
CSS Lessons Learned the Hard Way (ConvergeSE)CSS Lessons Learned the Hard Way (ConvergeSE)
CSS Lessons Learned the Hard Way (ConvergeSE)
 
Таблицы Html
Таблицы HtmlТаблицы Html
Таблицы Html
 
Uwe usability evaluation
Uwe usability evaluationUwe usability evaluation
Uwe usability evaluation
 
Joomla Request To Response
Joomla Request To ResponseJoomla Request To Response
Joomla Request To Response
 
Bdd and dsl как способ построения коммуникации на проекте
Bdd and dsl как способ построения коммуникации на проектеBdd and dsl как способ построения коммуникации на проекте
Bdd and dsl как способ построения коммуникации на проекте
 
Show vs. Tell in UX Design (Front in Amsterdam)
Show vs. Tell in UX Design (Front in Amsterdam)Show vs. Tell in UX Design (Front in Amsterdam)
Show vs. Tell in UX Design (Front in Amsterdam)
 
Пингвины из калининграда
Пингвины из калининградаПингвины из калининграда
Пингвины из калининграда
 
решение основной проблемы Agile (scrum) проектов в контексте ba
решение основной проблемы Agile (scrum) проектов в контексте baрешение основной проблемы Agile (scrum) проектов в контексте ba
решение основной проблемы Agile (scrum) проектов в контексте ba
 
Тестирование требований
Тестирование требованийТестирование требований
Тестирование требований
 
Box Model
Box ModelBox Model
Box Model
 
17. основы css (cascading style sheets)
17. основы css (cascading style sheets)17. основы css (cascading style sheets)
17. основы css (cascading style sheets)
 
Верстка_Лекция1
Верстка_Лекция1Верстка_Лекция1
Верстка_Лекция1
 
6. таблицы и другие теги html
6. таблицы и другие теги html6. таблицы и другие теги html
6. таблицы и другие теги html
 
How Joomla Works
How Joomla WorksHow Joomla Works
How Joomla Works
 
Images and Tables in HTML
Images and Tables in HTMLImages and Tables in HTML
Images and Tables in HTML
 

Similaire à Flexbox Fundamentals: Deciding When and How to Use Flexbox Layout

Putting Flexbox into Practice
Putting Flexbox into PracticePutting Flexbox into Practice
Putting Flexbox into PracticeZoe Gillenwater
 
Enhancing Responsiveness With Flexbox (Smashing Conference)
Enhancing Responsiveness With Flexbox (Smashing Conference)Enhancing Responsiveness With Flexbox (Smashing Conference)
Enhancing Responsiveness With Flexbox (Smashing Conference)Zoe Gillenwater
 
Flexbox Will Shock You!
Flexbox Will Shock You!Flexbox Will Shock You!
Flexbox Will Shock You!Scott Vandehey
 
CSS Lessons Learned the Hard Way (Beyond Tellerand)
CSS Lessons Learned the Hard Way (Beyond Tellerand)CSS Lessons Learned the Hard Way (Beyond Tellerand)
CSS Lessons Learned the Hard Way (Beyond Tellerand)Zoe Gillenwater
 
CSS Lessons Learned The Hard Way – Zoe Gillenwater
CSS Lessons Learned The Hard Way – Zoe GillenwaterCSS Lessons Learned The Hard Way – Zoe Gillenwater
CSS Lessons Learned The Hard Way – Zoe Gillenwaterbeyond tellerrand
 
Is Flexbox the Future of Layout?
Is Flexbox the Future of Layout?Is Flexbox the Future of Layout?
Is Flexbox the Future of Layout?jameswillweb
 
Show & tell - Flex in flux
Show & tell - Flex in fluxShow & tell - Flex in flux
Show & tell - Flex in fluxDan Dineen
 
CSS Lessons Learned the Hard Way (Generate Conf)
CSS Lessons Learned the Hard Way (Generate Conf)CSS Lessons Learned the Hard Way (Generate Conf)
CSS Lessons Learned the Hard Way (Generate Conf)Zoe Gillenwater
 
The New CSS Layout - dotCSS
The New CSS Layout - dotCSSThe New CSS Layout - dotCSS
The New CSS Layout - dotCSSRachel Andrew
 
Responsive Flexbox Inspiration (Responsive Day Out)
Responsive Flexbox Inspiration (Responsive Day Out)Responsive Flexbox Inspiration (Responsive Day Out)
Responsive Flexbox Inspiration (Responsive Day Out)Zoe Gillenwater
 
Understanding the flex layout
Understanding the flex layoutUnderstanding the flex layout
Understanding the flex layoutBarak Drechsler
 
Building Layouts with CSS
Building Layouts with CSSBuilding Layouts with CSS
Building Layouts with CSSBoris Paillard
 
CSS Conf Budapest - New CSS Layout
CSS Conf Budapest - New CSS LayoutCSS Conf Budapest - New CSS Layout
CSS Conf Budapest - New CSS LayoutRachel Andrew
 
Is Flexbox the Future of Layout -bdconf
Is Flexbox the Future of Layout -bdconfIs Flexbox the Future of Layout -bdconf
Is Flexbox the Future of Layout -bdconfjameswillweb
 
CSS Flexbox (flexible box layout)
CSS Flexbox (flexible box layout)CSS Flexbox (flexible box layout)
CSS Flexbox (flexible box layout)Woodridge Software
 
Understanding Flexbox Layout in React Native.pdf
Understanding Flexbox Layout in React Native.pdfUnderstanding Flexbox Layout in React Native.pdf
Understanding Flexbox Layout in React Native.pdfKaty Slemon
 
CSS3 Flex Layout
CSS3 Flex LayoutCSS3 Flex Layout
CSS3 Flex LayoutNeha Sharma
 

Similaire à Flexbox Fundamentals: Deciding When and How to Use Flexbox Layout (20)

Putting Flexbox into Practice
Putting Flexbox into PracticePutting Flexbox into Practice
Putting Flexbox into Practice
 
Enhancing Responsiveness With Flexbox (Smashing Conference)
Enhancing Responsiveness With Flexbox (Smashing Conference)Enhancing Responsiveness With Flexbox (Smashing Conference)
Enhancing Responsiveness With Flexbox (Smashing Conference)
 
Flexbox Will Shock You!
Flexbox Will Shock You!Flexbox Will Shock You!
Flexbox Will Shock You!
 
CSS Lessons Learned the Hard Way (Beyond Tellerand)
CSS Lessons Learned the Hard Way (Beyond Tellerand)CSS Lessons Learned the Hard Way (Beyond Tellerand)
CSS Lessons Learned the Hard Way (Beyond Tellerand)
 
CSS Lessons Learned The Hard Way – Zoe Gillenwater
CSS Lessons Learned The Hard Way – Zoe GillenwaterCSS Lessons Learned The Hard Way – Zoe Gillenwater
CSS Lessons Learned The Hard Way – Zoe Gillenwater
 
A complete guide to flexbox
A complete guide to flexboxA complete guide to flexbox
A complete guide to flexbox
 
Is Flexbox the Future of Layout?
Is Flexbox the Future of Layout?Is Flexbox the Future of Layout?
Is Flexbox the Future of Layout?
 
Show & tell - Flex in flux
Show & tell - Flex in fluxShow & tell - Flex in flux
Show & tell - Flex in flux
 
CSS Lessons Learned the Hard Way (Generate Conf)
CSS Lessons Learned the Hard Way (Generate Conf)CSS Lessons Learned the Hard Way (Generate Conf)
CSS Lessons Learned the Hard Way (Generate Conf)
 
The New CSS Layout - dotCSS
The New CSS Layout - dotCSSThe New CSS Layout - dotCSS
The New CSS Layout - dotCSS
 
Responsive Flexbox Inspiration (Responsive Day Out)
Responsive Flexbox Inspiration (Responsive Day Out)Responsive Flexbox Inspiration (Responsive Day Out)
Responsive Flexbox Inspiration (Responsive Day Out)
 
Understanding the flex layout
Understanding the flex layoutUnderstanding the flex layout
Understanding the flex layout
 
Layout with flexbox
Layout with flexboxLayout with flexbox
Layout with flexbox
 
World of Flexbox
World of Flexbox World of Flexbox
World of Flexbox
 
Building Layouts with CSS
Building Layouts with CSSBuilding Layouts with CSS
Building Layouts with CSS
 
CSS Conf Budapest - New CSS Layout
CSS Conf Budapest - New CSS LayoutCSS Conf Budapest - New CSS Layout
CSS Conf Budapest - New CSS Layout
 
Is Flexbox the Future of Layout -bdconf
Is Flexbox the Future of Layout -bdconfIs Flexbox the Future of Layout -bdconf
Is Flexbox the Future of Layout -bdconf
 
CSS Flexbox (flexible box layout)
CSS Flexbox (flexible box layout)CSS Flexbox (flexible box layout)
CSS Flexbox (flexible box layout)
 
Understanding Flexbox Layout in React Native.pdf
Understanding Flexbox Layout in React Native.pdfUnderstanding Flexbox Layout in React Native.pdf
Understanding Flexbox Layout in React Native.pdf
 
CSS3 Flex Layout
CSS3 Flex LayoutCSS3 Flex Layout
CSS3 Flex Layout
 

Plus de Zoe Gillenwater

Just One (CSS Dev Conference keynote)
Just One (CSS Dev Conference keynote)Just One (CSS Dev Conference keynote)
Just One (CSS Dev Conference keynote)Zoe Gillenwater
 
Building Responsive Layouts
Building Responsive LayoutsBuilding Responsive Layouts
Building Responsive LayoutsZoe Gillenwater
 
The Future of CSS Layout
The Future of CSS LayoutThe Future of CSS Layout
The Future of CSS LayoutZoe Gillenwater
 
Building Responsive Layouts
Building Responsive LayoutsBuilding Responsive Layouts
Building Responsive LayoutsZoe Gillenwater
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignZoe Gillenwater
 
CSS3: Using media queries to improve the web site experience
CSS3: Using media queries to improve the web site experienceCSS3: Using media queries to improve the web site experience
CSS3: Using media queries to improve the web site experienceZoe Gillenwater
 
Designing with CSS3 Effectively & Efficiently
Designing with CSS3 Effectively & EfficientlyDesigning with CSS3 Effectively & Efficiently
Designing with CSS3 Effectively & EfficientlyZoe Gillenwater
 
Effective and Efficient Design with CSS3
Effective and Efficient Design with CSS3Effective and Efficient Design with CSS3
Effective and Efficient Design with CSS3Zoe Gillenwater
 
Highly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSHighly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSZoe Gillenwater
 
Designing CSS Layouts for the Flexible Web
Designing CSS Layouts for the Flexible WebDesigning CSS Layouts for the Flexible Web
Designing CSS Layouts for the Flexible WebZoe Gillenwater
 

Plus de Zoe Gillenwater (13)

Just One (CSS Dev Conference keynote)
Just One (CSS Dev Conference keynote)Just One (CSS Dev Conference keynote)
Just One (CSS Dev Conference keynote)
 
CSS3 Layout
CSS3 LayoutCSS3 Layout
CSS3 Layout
 
Building Responsive Layouts
Building Responsive LayoutsBuilding Responsive Layouts
Building Responsive Layouts
 
The Future of CSS Layout
The Future of CSS LayoutThe Future of CSS Layout
The Future of CSS Layout
 
Building Responsive Layouts
Building Responsive LayoutsBuilding Responsive Layouts
Building Responsive Layouts
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive Design
 
CSS3: Using media queries to improve the web site experience
CSS3: Using media queries to improve the web site experienceCSS3: Using media queries to improve the web site experience
CSS3: Using media queries to improve the web site experience
 
Web Accessibility
Web AccessibilityWeb Accessibility
Web Accessibility
 
Real-world CSS3
Real-world CSS3Real-world CSS3
Real-world CSS3
 
Designing with CSS3 Effectively & Efficiently
Designing with CSS3 Effectively & EfficientlyDesigning with CSS3 Effectively & Efficiently
Designing with CSS3 Effectively & Efficiently
 
Effective and Efficient Design with CSS3
Effective and Efficient Design with CSS3Effective and Efficient Design with CSS3
Effective and Efficient Design with CSS3
 
Highly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSHighly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSS
 
Designing CSS Layouts for the Flexible Web
Designing CSS Layouts for the Flexible WebDesigning CSS Layouts for the Flexible Web
Designing CSS Layouts for the Flexible Web
 

Dernier

Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceDelhi Call girls
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirtrahman018755
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 

Dernier (20)

Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 

Flexbox Fundamentals: Deciding When and How to Use Flexbox Layout

  • 1. Flexbox Zoe Mickley Gillenwater @zomigiCSS Summit July 2016 TODAY USING
  • 2. I work for Psst…you can too: www.workingatbooking.com
  • 3. My portfolio site from 2000
  • 4. My portfolio site from 2000
  • 7. Deciding when to use and not use flexbox WHEN ¨ 1.
  • 8. What browsers do I need to support? Don’t ask yourself this—it’s irrelevant here (IMO)
  • 9. Flexbox has 96.8% coverage worldwide We support IE 7-9 at Booking, but still use flexbox as progressive enhancement.
  • 10. Do I want to create a layout in 1 dimension (row OR column) or 2 dimensions? Hat-tip to Rachel Andrew: https://rachelandrew.co.uk/archives/2016/03/30/should-i-use-grid-or-flexbox/
  • 11. Flexbox is not a grid ¨  Not meant for or great at whole page layout ¨  Flex items only care about space in their own row/column ¨  They don’t care about lining up in the other dimension
  • 12. Demo by Rachel Andrew: http://codepen.io/rachelandrew/pen/YqqdXL
  • 13. Flexbox is best for: ¨  UI components ¨  Simple whole page layouts (not grid-based) ¨  Enhancing a complex layout’s alignment, spacing, etc. (not controlling placement)
  • 14.
  • 15. Do I need my content to dictate sizing and placement, or do I need to control these?
  • 16. Content determines boxes’ size and placement (Mega-useful when content is unknown and variable, or readability is a top priority.) Structure determines content’s size and placement (P.S. Flexbox can do this too, if you want. It’s just the reverse that doesn’t work so well.) Flexbox Grids
  • 17. Does flexbox offer me anything I can’t already get from an existing layout method?
  • 18. New things flexbox offers ¨  Content-driven, unit-less sizes ¨  Content-driven, media-query-less layout changes ¨  Mixed-unit layouts ¨  Equal-height columns ¨  Vertical centering and other alignments ¨  Spacing out or stretching items to fill unknown width/height ¨  Combining content wrapping and block wrapping ¨  Pinning items without overlaps ¨  Visual order different than HTML/reading order
  • 19. Components flexbox can enhance and UI/UX problems it can help you solve WHAT ¨ 2.
  • 21. How big do I make this thing?
  • 23. Relative units of measurement are your best guess at the ideal, but they’re still a guess.
  • 24. Flexbox gets us closer to the ideal, because it lets us design without units.
  • 25. Example: a responsive form from http://jobs.theguardian.com/
  • 26. My copy of that form Same floats, same percentage widths
  • 27. The trouble with explicit sizing Since the select and button are sized by a percentage, not sized automatically by their content, this can happen: Box too small for its content Box too big for its content
  • 28. Use the flex property instead Tells browser starting size (including content size) and whether item can grow or shrink width: 33.333% flex: auto Fill up remaining space width: 16.666% flex: none Size to content exactly
  • 29. Form fields are a pain in the butt The fields and button don’t all match each other exactly in height
  • 30. Fix alignment with flexbox Turn each field wrapper into flex container so field inside will stretch to match height of line: .flexbox .jobs-form_field-wrapper { display: flex; align-items: stretch; /* default */ width: auto; } Fields misaligned without flexbox Fields match height due to align-items
  • 32. Content-driven sizing on Booking.com Last year’s sidebar searchbox design, with fixed-width select fields
  • 33. Content-driven sizing on Booking.com Non-flexbox Flexbox enhanced
  • 34. Content-driven sizing on Booking.com .sb-dates { display: flex; } .sb-dates__icon { flex: 0 0 23px; } .sb-dates__select-day { flex: 1 0 auto; margin: 0 6px; } .sb-dates__select-month { flex: 1 1 auto; } flex container main axis flex items
  • 35. Defining the flex property flex-grow how much flex item will grow relative to other items if extra space is available (proportion of extra space that it gets) flex-shrink how much item will shrink relative to others if there is not enough space (proportion of overflow that gets shaved off) flex-basis the initial starting size before free space is distributed (any standard width/height value, including auto)
  • 36. Translating the flex property .sb-dates { display: flex; } .sb-dates__icon { flex: 0 0 23px; } .sb-dates__select-day { flex: 1 0 auto; margin: 0 6px; } .sb-dates__select-month { flex: 1 1 auto; } Start out 23px wide, and don’t grow or shrink further Start out sized to your content, then grow with 1 share of any extra space available, but don’t ever shrink Start out sized to your content, then grow with 1 share of extra space, but if there’s an overflow shrink
  • 37. Mixed-unit layout is easier with calc(), but not even it can do: calc(100% - 23px - the width of the day field in Greek)
  • 38. Taking advantage of variable space Task: add a message about low availability of the room price shown: “We have only X left on our site!” How about right here in this lovely big gap?
  • 39. Taking advantage of variable space Problem: the gap is not always big enough to hold a sentence of text
  • 40. Taking advantage of variable space Solution: use flexbox to place text beside price when space allows; otherwise, it can wrap below price
  • 42. Content-driven layout change 2 columns 3 columns
  • 43. RWD content-driven layout change Narrow: 1 column Wide: 2 columns
  • 44. RWD content-driven layout change .article-header { display: flex; flex-flow: row wrap; margin-left: -20px; } .article-header-image { flex: 1 1 320px; padding-left: 20px; } When 320px + 20em can fit together, layout shifts to 1 row/2 columns .article-header-text { flex: 1 1 20em; padding-left: 20px; }
  • 45. Layout change without media query 1.  Let the blocks wrap and stack when needed: .article-header { display: flex; flex-direction: row; flex-wrap: wrap; } /* default */
  • 46. Layout change without media query 2.  Size the blocks to control their wrapping point: .article-header-image { flex: 1 1 320px; padding-left: 20px; } .article-header-text { flex: 1 1 20em; padding-left: 20px; }
  • 47. Stretching to fill unknown width/height flex: 1 1 auto align-content: space-between
  • 48. Improved wrapping in RWD layout With float or text-align With flex or justify-content
  • 49. Flexbox is great for spacing and aligning stuff, especially shifting content in RWD.
  • 50. Demo: full-width nav bar ¨  All links on same line ¨  First link flush left, last link flush right ¨  Equal spaces between all links
  • 51. Trying display:table-cell J All links on same line J First link flush left, last link flush right L Equal spaces between all links
  • 53. Starter centered nav bar, no flexbox .menu-list { margin: 0; padding: 0; list-style: none; text-align: center; } http://codepen.io/zomigi/pen/vKjbbY/ .menu-list-item { display: inline-block; padding: 16px 32px; }
  • 54. Enhanced to full-width with flexbox .menu-list { display: flex; justify-content: space-between; /* equally spaces items across width */ margin: 0; padding: 0; list-style: none; text-align: center; /* fallback */ } .menu-list-item { display: inline-block; /* fallback */ padding: 0 .5em; /* fallback */ }
  • 58. Demo: full-height menu .menu-list { display: flex; flex-direction: column; justify-content: space-between; } .menu-list-item { height: 100%; display: flex; align-items: center; } .menu-list { display: flex; flex-direction: column; } .menu-list-item { flex: 1 0 auto; display: flex; align-items: center; } justify-content version flex version
  • 59. Demo: full-height menu .menu-list { display: flex; flex-direction: column; justify-content: space-between; } .menu-list-item { height: 100%; display: flex; align-items: center; } .menu-list { display: flex; flex-direction: column; } .menu-list-item { flex: 1 0 auto; display: flex; align-items: center; } justify-content version flex version
  • 60. Flexbox can also enhance visual ordering.
  • 61. order integer to specify flow order of flex items 0 0 0 default source order 0 0 1 0 0 re-ordered 0 0 0 0 -1 re-ordered 0 0 2 1 0 re-ordered 1 0
  • 62. Reorder for good, not evil.
  • 63. Demo: moving a photo on mobile
  • 64. Demo: moving a photo on mobile Desktop: HTML order (no flexbox)Mobile: reordered
  • 65. Use flexbox order in mobile styles .recipe { display: flex; flex-direction: column; } .recipe figure { order: -1; /* before all items with default order: 0 */ } .recipe figure img { width: 100%; }
  • 66. Turn off flexbox in desktop styles @media screen and (min-width:800px) { .recipe { display: block; /* turn off flexbox */ } .recipe figure { float: right; width: 55%; } }
  • 67. Demo: moving a photo on mobile Flexbox enhanced Non-flexbox
  • 68. Reordering on The Guardian 12 3 4 56 flex-direction: row-reverse flex-direction: row-reverse 1 2 3 4 5 6
  • 69. These examples don’t look wrong or broken without flexbox. Flexbox just enhances their sizing and spacing to look better.
  • 70. Step-by-step process for adding flexbox to your UI components effectively HOW ¨ 3.
  • 72. Decide whether flexbox is the right tool for the job
  • 73. Decide which versions of flexbox to support standard, 2011/2012, and/or 2009
  • 74. Browser support approaches to choose ¨  Use only the non-prefixed, standard syntax ¨  … plus browser-prefixed versions of standard syntax ¨  … plus -ms- prefixed 2011/2012 syntax ¨  … plus -webkit- prefixed 2009 syntax http://caniuse.com/#feat=flexbox
  • 75. I recommend you skip the ‘09 syntax ¨  It’s slower to render than current syntax* ¨  Doesn’t support wrapping ¨  Its browsers have small market share ¨  If using flexbox for progressive enhancement, its browsers can get same fallback given to non-supporting browsers * http://updates.html5rocks.com/2013/10/Flexbox-layout-isn-t-slow
  • 76. Let tools add browser variants for you Which variants do you want? Best tool to handle that All the things! Autoprefixer Bourbon (Sass) Only the standard syntax, with and without prefixes Compass (Sass) Some other combination (such as everything except 2009) Sass or LESS mixins, such as https://github.com/mastastealth/ sass-flex-mixin
  • 77. Add Modernizr as needed with flexbox Flexbox and fallback styles can often co- exist, but sometimes need to isolate them http://zomigi.com/blog/using-modernizr-with-flexbox/
  • 78. Or use @supports .gallery-item { display: inline-block; } @supports (flex-wrap: wrap) { .gallery { display: flex; flex-wrap: wrap; } } https://developer.mozilla.org/en-US/docs/Web/CSS/@supports But IE 10-11, which do support flexbox but don’t support @supports, won’t get these styles
  • 79. Choose and add appropriate starter/fallback layout CSS
  • 80. Things to consider Do I need content blocks to wrap? not table-cell Do I want to prevent blocks from wrapping? floats, inline-block, but table-cell best Do I need content-driven sizes? floats, but table-cell or inline-block best Do I need vertical alignment? inline-block, table-cell Do I need horizontal alignment? floats, table-cell, inline- block only with preset sizes
  • 81. Pick your starter layout CSS ¨  Floats ¨  table-cell ¨  inline-block ¨  Absolute positioning Flexbox will override: Flexbox will not override: Just use whatever you normally would; flexbox plays nicely with most of them.
  • 82. A real example of this process
  • 83. Split left-right layout Task: lay out review score and price, on opposite sides of same line Needs: ¨  content-driven sizing ¨  horizontal alignment ¨  wrapping score price or “sold out”
  • 84. Adding the starter CSS .iw_mini_review_score_wrapper { float: left; } .iw_mini_price_wrapper { float: right; }
  • 86. Decide whether entire component needs to be block or inline-block display:flex or inline-flex
  • 87. Creating the block flex container .iw_mini_details_wrapper { display: flex; } .iw_mini_review_score_wrapper { float: left; } .iw_mini_price_wrapper { float: right; } Flex container sits on a new row below, like a block element
  • 88. Decide flow of flex items
  • 89. Things to consider Lay out horizontally or vertically? flex-direction:row or column Allow boxes to wrap? flex-wrap:wrap, wrap-reverse or nowrap Order different than source? order values; flex-direction: row-reverse or column-reverse
  • 90. Allowing wrapping .iw_mini_details_wrapper { display: flex; flex-wrap: wrap; } .iw_mini_review_score_wrapper { float: left; } .iw_mini_price_wrapper { float: right; } Allows second block to wrap down if needed
  • 91. Decide which items can grow to fill space, shrink to avoid overflow, or must stay at a certain size
  • 92. Tips for setting flex values ¨  Write out full flex values, rather than using single-digit and keyword values ¤  flex: 1 1 0% instead of flex: 1 ¤  Hidden default values can lead to mistakes ¤  Avoids IE 10-11 bugs ¨  Think about it backwards: first decide flex-basis, then -shrink, then -grow
  • 93. Tips for setting flex-basis values ¨  Acts like min-width when wrapping on ¨  If flex-wrap off and flex-shrink on, browser can go smaller than flex-basis ¨  Be careful with flex-basis:0 when wrapping ¨  Use flex-basis:auto whenever possible
  • 94. Setting flex-shrink ¨  Always have at least 1 item per line that can shrink (or wrap, or both)
  • 95. Setting flex-grow ¨  Decide what to do with extra space ¤  Fill it up? (flex-grow: 1, 2, etc.) ¤  Leave it? (flex-grow: 0)
  • 96. Setting flex values .iw_mini_details_wrapper { display: flex; flex-wrap: wrap; } .iw_mini_review_score_wrapper { float: left; flex: 0 1 auto; } .iw_mini_price_wrapper { float: right; flex: 0 1 auto; } Size to content, shrink smaller if you have to, don’t grow bigger (default value)
  • 97. Decide how to align flex items
  • 98. Main axis alignment (horizontal when row, vertical when column) Cross axis alignment (vertical when row, horizontal when column) (P.S. Also responsible for equal-height columns) justify-content align-items
  • 99. Controlling alignment .iw_mini_details_wrapper { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; } .iw_mini_review_score_wrapper { float: left; } .iw_mini_price_wrapper { float: right; } Moves first item to left, last item to right
  • 101. Flexbox with float fallback .iw_mini_details_wrapper { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; } .iw_mini_review_score_wrapper { float: left; } .iw_mini_price_wrapper { float: right; } Flexbox properties on container override floating automatically in supporting browsers Floating gets used by old browsers
  • 102. Test
  • 103. Testing your flexbox ¨  Too Flexy bookmarklet for toggling Modernizr flexbox classes: http://chriswrightdesign.github.io/tooflexy/ ¨  If reordering, check tabbing and screen reading order to make sure it’s still logical
  • 105. Fixing browsers’ flexbox bugs ¨  Read explanations and workarounds by Philip Walton: https://github.com/philipwalton/flexbugs ¨  Let PostCSS fix some for you: https://github.com/luisrudge/postcss-flexbugs-fixes
  • 106. Summing up the process 1.  Decide whether to use flexbox and which browser versions of it 2.  Choose and add starter layout CSS 3.  Choose and add flexbox CSS 1.  Block or inline-block container 2.  Flow 3.  Flex to control sizing 4.  Alignment 4.  Test and fix bugs
  • 107. Flexbox is not for the future. You can use flexbox today.