Web Design

Flexbox Basics (Centering Things)

display: flex turns an element into a row (by default) that lines up its children neatly instead of letting them stack randomly. Once something is a flex container, justify-content controls spacing along the row (try "center" or "space-between") and align-items controls up/down alignment (try "center").

This is the single most useful CSS trick for centering things — way easier than the old tricks people used before flexbox existed.

Your turn

Put 3 <div> boxes inside a container, make the container display: flex, and center them with justify-content and align-items.

Output shows up here when you Run.
Ask JARVIS for a hint