Use CSS Flexbox to layout application
Two axis
The main axis
- Defined by
flex-direction - Use
justify-contentto align items on the main axis
The cross axis
- Perpendicular to the main axis
- Use
align-itemsto align items on the cross axis
Start and End
- Depends on the
writing-modevalue, eg: English has left as start, right as end.
Flex container
display: flexordisplay: inline-flex- Direct children become flex items.
Flex items
- Displayed as specified by
flex-direction - Start from the start edge of the main axis
- Do not stretch on the main dimension, but can shrink.
- Will stretch to fill the size of the cross axis.
- The
flex-basisproperty is set toauto. - The
flex-wrapproperty is set tonowrap. - Will overflow container
Shorthand
flexflex-growflex-shrinkflex-basis- Specified on flex item
flex-flowflex-directionflex-wrap- Specified on flex container