5 min read
2026-02-03
The `gap` property adds spaces only between elements, without extra padding at the edges.
To center an element along both axes, three properties on the container are enough: `display: flex`, `justify-content: center`, `align-items: center`.
Flex elements do not shrink below the content size by default. Add `min-width: 0` for correct overflow behavior.
`flex: 1` is equivalent to `flex-grow: 1; flex-shrink: 1; flex-basis: 0%`.
`margin-left: auto` on a flex element pushes it to the right edge - useful for navigation.
`flex-wrap: wrap` with `flex-basis` creates a responsive grid without media queries.
The `order` property changes the visual order, but not the DOM order, which can be detrimental to accessibility.
Experiment with different property combinations in our interactive Playground.
See also: Grid Playground, Color Picker, HTML Formatter