102 WDB Flexbox Responsive
102 WDB Flexbox Responsive
CSS FLEXBOX
You'll love it!
WHAT IS IT?
Flexbox is a one-dimensional layout
method for laying out items in rows
or columns
IT'S NEW(ISH)
The Basics Flexbox is a recent addition to CSS,
included to address common
layout frustations
WHY 'FLEX'?
Flexbox allows us to distribute
space dynamically across elements
of an unknown size, hence the
term "flex"
The Flex Model
MAIN AXIS
CROSS AXIS
FLEX DIRECTION
flex-direction: row;
FLEX DIRECTION
flex-direction: row-reverse;
FLEX DIRECTION
flex-direction: column;
flex-direction: column-reverse;
FLEX WRAP
flex-wrap: wrap;
JUSTIFY CONTENT
justify-content: flex-start;
JUSTIFY CONTENT
justify-content: flex-end;
JUSTIFY CONTENT
justify-content: center;
JUSTIFY CONTENT
justify-content: space-between;
JUSTIFY CONTENT
justify-content: space-around;
ALIGN ITEMS
align-items: flex-start;
ALIGN ITEMS
align-items: flex-end;
ALIGN ITEMS
align-items: center;
ALIGN ITEMS
align-items: stretch;
ALIGN CONTENT
align-content:space-between;
ALIGN CONTENT
align-content:flex-start;
ALIGN CONTENT
align-content:flex-end;
ALIGN CONTENT
align-content:center;
ALIGN SELF
align-self: flex-end;
FLEX-BASIS
Defines the initial size of an
element before additional space is
distributed.
Flex Sizing FLEX-GROW
FLEX-SHRINK
If items are larger than the
container, they shrink according to
flex-shrink.
THE PROBLEM
As mobile devices and tablets
became widely available,
developers had a problem...how do
we create websites that look good
on all screen sizes?
ONE APPROACH
RESPONSIVE Early on, it was common to create
separate stylesheets for different
devices, or even completely
DESIGN different websites for each size.
QUERIES
QUERIES