justify-content & align-items
justify-content
justify-content in a container with flex-direction: column, aligns the child elements vertically inside the flex container.
- flex-start (default): Aligns all elements at the top of the container.
- center: Centers elements vertically.
- flex-end: Aligns all elements at the bottom of the container.
- space-between: First element at the top, last at the bottom, others spaced in between.
- space-around: Equal space around each element, with half of it at the edges.
- space-evenly: Equal space between elements and around them.
align-items
align-items in a container with flex-direction: column, aligns the child elements horizontally.
- stretch (default): Elements stretch horizontally to the container’s width (if no fixed width is set).
- flex-start: Aligns all elements to the left.
- center: Centers elements horizontally.
- flex-end: Aligns all elements to the right.
Example
With this dynamic example you can see the different arrangements of the child elements by modifying the justify-content and align-items properties in the selectors.
ResultLive
html
css