What is Flexbox

Flexible Box Module (Flexbox) is a new way to create complicated layout of a web page or a part of a web page. Flexbox provides a more efficient way to lay out, align and distribute space among items in a container

Flexbox has two parts. One is parent which is a container having css property display:flex or display:inline-flex and second part is its direct children called flex items.

Parent (Flexbox) CSS properties:

.container {
     display: flex | inline-flex;
     flex-direction: row | row-reverse | column | column-reverse;
     flex-wrap: nowrap | wrap | wrap-reverse;
     flex-flow: <‘flex-direction’> || <‘flex-wrap’>
     justify-content: flex-start | flex-end | center | space-between | space-around | space-evenly;
     align-items: flex-start | flex-end | center | baseline | stretch;
     align-content: flex-start | flex-end | center | space-between | space-around | stretch; 
 }

Childrens (Flexbox Items) CSS properties:

.container .item {
     order: <integer>; /* default is 0 */
     flex-grow: <number>; /* default 0 */
     flex-shrink: <number>; /* default 1 */
     flex-basis: <length> | auto; /* default auto */
     flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]
     align-self: auto | flex-start | flex-end | center | baseline | stretch;
     align-content: flex-start | flex-end | center | space-between | space-around | stretch; 
 }

Note that float, clear and vertical-align have no effect on a flex item.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s