Evenly distributes child elements within a parent element.
display: flex
to use the flexbox layout.justify-content: space-between
to evenly distributes child elements horizontally. The first item is positioned at the left edge, while the last item is positioned at the right edge.justify-content: space-around
to distribute the children with space around them, instead of between them.Item1
Item2
Item3
<div class="evenly-distributed-children">
<p>Item1</p>
<p>Item2</p>
<p>Item3</p>
</div>
.evenly-distributed-children {
display: flex;
justify-content: space-between;
}
CSS, Layout
Horizontally and vertically centers a child element within a parent element using flexbox.
CSS, Layout
Horizontally and vertically centers a child element within a parent element using grid
.
CSS, Layout
Vertically and horizontally centers a child element within its parent element, using display: table
.