On Github nucliweb / flexbox
.wrapper { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; } .wrapper div { -webkit-box-flex: 1; -webkit-flex: 1 1 0; -ms-flex: 1 1 0; flex: 1 1 0; }
(flex container)
.flexcontainer { display: flex; } .flexcontainer div { flex-grow: 0; flex-shrink: 0; flex-basis: auto; /* flex: 0 0 auto; */ }
.flexcontainer { display: flex; } .flexcontainer div { flex: 1 0 auto; }
.flexcontainer-inline { display: inline-flex; } .flexcontainer-inline div { flex: 1 0 auto; }
.flexcontainer { display: flex; flex-direction: row; /* row | row-reverse | column | column-reverse */ } .flexcontainer div { flex: 1 0 auto; }
.flexcontainer { display: flex; flex-direction: row-reverse; /* row | row-reverse | column | column-reverse */ } .flexcontainer div { flex: 1 0 auto; }
.flexcontainer { display: flex; flex-direction: column; /* row | row-reverse | column | column-reverse */ } .flexcontainer div { flex: 1 0 auto; }
.flexcontainer { display: flex; flex-direction: column-reverse; /* row | row-reverse | column | column-reverse */ } .flexcontainer div { flex: 1 0 auto; }
.flexcontainer { display: flex; flex-wrap: nowrap; /* nowrap | wrap | wrap-reverse */ } .flexcontainer div { flex: 1 0 auto; }
.flexcontainer { display: flex; flex-wrap: wrap; /* nowrap | wrap | wrap-reverse */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; flex-wrap: wrap-reverse; /* nowrap | wrap | wrap-reverse */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; justify-content: flex-start; /* flex-start | flex-end | center | space-between | space-around */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; justify-content: flex-end; /* flex-start | flex-end | center | space-between | space-around */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; justify-content: center; /* flex-start | flex-end | center | space-between | space-around */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; justify-content: space-between; /* flex-start | flex-end | center | space-between | space-around */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; justify-content: space-around; /* flex-start | flex-end | center | space-between | space-around */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; align-items: flex-start; /* auto | flex-start | flex-end | center | baseline | stretch */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; align-items: flex-end; /* auto | flex-start | flex-end | center | baseline | stretch */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; align-items: center; /* auto | flex-start | flex-end | center | baseline | stretch */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; align-items: baseline; /* auto | flex-start | flex-end | center | baseline | stretch */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; align-items: stretch; /* auto */ /* auto | flex-start | flex-end | center | baseline | stretch */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; align-content: stretch; /* flex-start | flex-end | center | space-between | space-around | stretch */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; align-items: flex-start; align-content: flex-start; /* flex-start | flex-end | center | space-between | space-around | stretch */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; align-items: flex-start; align-content: flex-end; /* flex-start | flex-end | center | space-between | space-around | stretch */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; align-items: flex-start; align-content: center; /* flex-start | flex-end | center | space-between | space-around | stretch */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; align-items: flex-start; align-content: space-between; /* flex-start | flex-end | center | space-between | space-around | stretch */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; align-items: flex-start; align-content: space-around; /* flex-start | flex-end | center | space-between | space-around | stretch */ } .flexcontainer div { flex: 0 0 auto; }
.flexcontainer { display: flex; align-items: stretch; align-content: stretch; /* flex-start | flex-end | center | space-between | space-around | stretch */ } .flexcontainer div { flex: 0 0 auto; }
(flex items)
.flexcontainer { display: flex; } .flexcontainer div { flex: 0 0 auto; } .flexcontainer div:nth-child(2) { order: -1; }
.flexcontainer { display: flex; } .flexcontainer div { flex: 0 0 auto; } .flexcontainer div:nth-child(2) { flex-grow: 2; /* default 0 */ }
.flexcontainer { display: flex; } .flexcontainer div { flex: 0 0 auto; } .flexcontainer div:nth-child(2) { flex-grow: 2; } .flexcontainer div:nth-child(4) { flex-grow: 4; }
.flexcontainer { display: flex; } .flexcontainer div { flex: 1 0 30%; } .flexcontainer div:nth-child(2) { flex-shrink: 2; } .flexcontainer div:nth-child(4) { flex-shrink: 4; }
.flexcontainer { display: flex; } .flexcontainer div { flex: 1 0 15%; } .flexcontainer div:nth-child(2) { flex-basis: 50%; }
.item { flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]; }
This is the shorthand for flex-grow, flex-shrink & flex-basis combined. The second and third parameters (flex-shrink and flex-basis) are optional. Default is 0 1 auto.
.flexcontainer { display: flex; align-items: flex-start; } .flexcontainer div { flex: 0 0 auto; } .flexcontainer div:nth-child(3) { align-self: flex-end; /* auto | flex-start | flex-end | center | baseline | stretch */ }
Available space = (container size - flex-basis siblings total)
Grow unit = (Available space / Sum Grow siblings total)
Flex item size = (Flex basis + (Grow Unit * num))
Joan Leon