display:inline
Each element is sized by its contents and displays in a single wrapping line.display:block (default)
Each element is on its own line. If no width is specified, the element spans the viewport.display:block
Each element is on its own line. If a width is specified, each element spans the specified width.display:flex
Each element is in a single horizontal (or vertical) wrapping row sized by its contents with any excess or insufficiency of space distributed according to its flex properties.display:flex; flex-direction: row;
(default) justify-content: flex-start;
(default)display:flex; flex-direction: row-reverse;
display:flex; justify-content:center;
display:flex; justify-content:flex-end;
display:flex; justify-content:space-between;
display:flex; justify-content:space-around;
display:flex; flex:1;
display:flex; flex:matching nth child;
display:flex; flex-wrap: nowrap;
(default)display:flex; flex-wrap: wrap;
display:flex; align-items:stretch;
display:flex; align-items:center;
display:flex; align-items:baseline;
display:inline-flex;
flex-grow, flex-shrink, flex-basis.
flex-grow, flex-shrink, flex-basis
can be short-handed to {flex:1 2 3;}
. Or {flex:1;} = flex-basis
. Or {flex:1 3;} = flex-grow, flex-basis.
{display:flex; width: auto; (default)} flex-grow: matches nth-child; flex-shrink: 1; (default), flex-basis 0% (default):
{display:flex; flex-wrap: wrap; width: auto;}
(default) flex:1 1 100px;
{display:flex; width: 90%;} flex:1 nth-child 100px;
:nth-child(1) {flex:1 1 min-content;} :nth-child(2) {flex:2 2 min-content;}
:nth-child(1) {flex:2 2 20rem;} :nth-child(2) {flex:1 1 10rem;}
flex-grow, shrink, basis,
flex cells will tend to line up verticallydisplay:flex; flex-direction:column
display:flex; flex-direction:column-reverse
display:flex; flex-direction:column; justify-content:center;
display:flex; flex-direction:column; justify-content:flex-end;
display:flex; flex-direction:column; justify-content:space-between;
display:flex; flex-direction:column; justify-content:space-around;
display:flex; flex-direction:column; flex:1;
display:flex; flex-direction:column; flex:matching nth child;
display:flex; flex-direction:column; align-items:stretch;
display:flex; flex-direction:column; align-items:center;
display:flex; flex-direction:column; align-items:baseline;
display:inline-flex; flex-direction:column
display:flex; flex:1; with child elements
3b | 3c |
3e | 3f |
3g | hc |