CSS Flexbox reference
Flexbox is a one-dimensional layout model: you lay items out along a main axis and align them on the cross axis. Properties split into two groups — those you set on the flex container and those you set on the flex items. This reference lists every standard property in each group with its accepted values, default, and a concise description, plus instant search.
How it works
Flex layout starts when a container gets display: flex (or inline-flex). The container properties — flex-direction, flex-wrap, justify-content, align-items, align-content, and gap — decide the axis and how children distribute and align. The item properties — order, flex-grow, flex-shrink, flex-basis, the flex shorthand, and align-self — override or tune individual children. The search filter matches both property names and their listed values so you can look up by either.
Tips and example
A common centered layout:
.box {
display: flex;
justify-content: center; /* main-axis centering */
align-items: center; /* cross-axis centering */
gap: 1rem;
}
- Remember
flex: 1equalsflex: 1 1 0%— items grow from a zero basis and share space evenly. align-itemssets the default for all children;align-selfoverrides it on one child.gapworks in flexbox in modern browsers, so you rarely need margins between items anymore.