Which CSS property, when set to 'flex', creates a flex container?

The story behind the answer

The CSS property that creates a flex container when set to `flex` is `display`.

The declaration `display: flex` changes the element's layout model so its direct children become flex items arranged along a main axis. The default direction is usually a row, but `flex-direction` can change it to a column or reverse either direction. `display: inline-flex` creates the same flex formatting context while making the container participate as an inline-level element.

Properties such as `justify-content`, `flex-direction`, and `flex-wrap` control how an existing flex container behaves; none of them creates the container by itself. Flexbox emerged from late-2000s work on responsive web layouts and became a W3C Candidate Recommendation in 2012. It is designed for arranging, distributing, and aligning content in one primary dimension.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: