KEMBAR78
#4 HTML & CSS [know-how] | PDF
Diving deep into the core
of the HTML & CSS
#4 The Flexbox Layout
@dalibor_gogic
[object Object]
The Flexbox Layout
The Flexbox Layout (Flexible Box) module aims
at providing a more efficient way to lay out, align and distribute
space among items in a container, even when their size
is unknown and/or dynamic.
The flexbox layout is direction-agnostic
as opposed to the regular layouts (block which is
vertically-based and inline which is horizontally-based).
.container {
display: flex | inline-flex;
}
https://codepen.io/daliborgogic/pen/VxqLJK
.container {
flex-direction: row | row-reverse | column | column-reverse;
}
https://codepen.io/daliborgogic/pen/QrJeEj
.container {
flex-wrap: nowrap | wrap | wrap-reverse;
}
https://codepen.io/daliborgogic/pen/vjvBmN
(Applies to: parent flex container element)
This is a shorthand flex-direction and flex-wrap properties,
which together define the flex container's main and cross axes.
Default is row nowrap.
flex-flow: <'flex-direction'> || <'flex-wrap'>;
https://codepen.io/daliborgogic/pen/aGPoYg
.container {
justify-content: flex-start | flex-end | center | space-between |
space-around | space-evenly;
}
https://codepen.io/daliborgogic/pen/gzZOOX
.container {
align-items: flex-start | flex-end | center | baseline | stretch;
}
https://codepen.io/daliborgogic/pen/odJNLB
.container {
align-content: flex-start | flex-end | center | space-between |
space-around | stretch;
}
https://codepen.io/daliborgogic/pen/aGPzby
.item {
order: <integer>; /* default is 0 */
}
https://codepen.io/daliborgogic/pen/odJgKO
.item {
flex-grow: <number>; /* default 0 */
}
https://codepen.io/daliborgogic/pen/GdPJqo
.item {
flex-shrink: <number>; /* default 1 */
}
https://codepen.io/daliborgogic/pen/PeXqpb
.item {
flex-basis: <length> | auto; /* default auto */
}
https://codepen.io/daliborgogic/pen/PeXqpb
This is the shorthand for flex-grow, flex-shrink and flex-basis combined.
The second and third parameters (flex-shrink and flex-basis) are optional.
Default is 0 1 auto.
.item {
flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]
}
https://codepen.io/daliborgogic/pen/PeXqpb
.item {
align-self: auto | flex-start | flex-end | center | baseline |
stretch;
}
https://codepen.io/daliborgogic/pen/rvoVob
This slide [is] intentionally left blank.

#4 HTML & CSS [know-how]