The flex-property is a shorthand property that specifies the components of a flex length:
Initial Makes the flex item inflexible when there is positive free space, but allows it to shrink to its minimum size when there is insufficient space.
/* Default (initial or 0 1 auto)*/
flex: initial;
flex: 0 1 auto;
none makes the flex item fully inflexible.
/* None = 0 0 auto. */
flex: none;
flex: 0 0 auto;
Auto: The flex box will absorb any free space
/* Auto = 1 1 auto. */
flex: auto;
flex: 1 1 auto;
/* positive-number = <positive-number> 1 0 */
flex: <positive-number>;
flex: <positive-number> 1 0 ;
Absolute flex starting from a flex basis of zero. Notice that the item with a flex factor of 2 grows twice as fast as the others.
<div id='main'>
<article>Short</article>
<nav>loooooonggg</nav>
<aside>short</aside>
</div>
#main { display: flex; text-align:center; padding: 1rem; width: 70%; box-sizing: border-box;}
#main > article { background-color: DeepSkyBlue; padding: inherit; flex:1 1 0; }
#main > nav { background-color: AliceBlue; padding: inherit; flex:1 1 0;}
#main > aside { background-color: CadetBlue; padding:inherit; flex:2 1 0;}
Relative flex starting from a flex basis of the item’s content size (auto). Notice that the item with a flex factor of 2 grows twice as fast as the others.
<div id='main'>
<article>Short</article>
<nav>loooooonggg</nav>
<aside>short</aside>
</div>
#main { display: flex; text-align:center; padding: 1rem; width: 70%; box-sizing: border-box;}
#main > article { background-color: DeepSkyBlue; padding: inherit; flex:1 1 auto; }
#main > nav { background-color: AliceBlue; padding: inherit; flex:1 1 auto;}
#main > aside { background-color: CadetBlue; padding:inherit; flex:2 1 auto;}