

To change their alignment, use justify-content, which can accept the following values:įlex-start : aligned at the start of the containerįlex-end : aligned at the end of the containerĬenter : aligned in the center of the container

We'll start with elements that are aligned horizontally because that's the case by default. Main and cross axes Alignment along the main axis If the elements are arranged vertically in a column (or columns), the main axis is vertical, and the cross axis is horizontal. If the elements are arranged horizontally in a row (or rows), the main axis is horizontal, and the cross axis is vertical. The perpendicular direction is therefore the cross axis. This "main" direction is what we call the flex items' main axis. Items in Flexbox are arranged horizontally or vertically depending on whether you specify row or column for your flex-direction.
