Beginner's guide to using flexbox
flex-direction
property establishes the main axis.justify-content
property defines how flex items are laid out along the main axis.align-items
property defines the default for how flex items are laid out along the cross axis.align-self
property defines how a single flex item it aligned on the cross axis, overriding the default
established by align-items
..container {
display: flex; /* or inline-flex */
}
row
: lines items from left to rightrow-reverse
: lines items from right to leftcolumn
: stacks items from top to bottomcolumn-reverse
: stacks items from bottom to top.container {
display: flex; /* or inline-flex */
flex-direction: row;
}
nowrap
: all flex items will be on one linewrap
: flex items will wrap onto multiple lines from top to bottomwrap-reverse
: flex items will wrap onto multple lines from bottom to top.container {
display: flex; /* or inline-flex */
flex-direction: row;
flex-wrap: wrap;
}
flex-flow: direction wrap
justify-content: center;
flext-start
flex-end
center
space-between
space-around
space-evenly
align-items: flex-start;
flex-start
flex-end
center
stretch
baseline
align-content: center;
flex-start
flex-end
center
stretch
space-between
space-around
.item {
order: integer
}
.item {
flex-grow: number /* default 0 */
}
.item {
flex-shrink: number /* default 1 */
}
// Using flex-grow polyfill
-ms-flex-positive: 2;
flex-grow: 2;