DEV Community

Hayes vincent
Hayes vincent

Posted on

Display :flex;

In CSS, the property display: flex; is used to create a flex container — a layout model that makes it easier to design flexible and responsive layouts.

🔹 Definition:

display: flex;
→ Turns the selected element into a flex container, and its direct children become flex items.

.container {
  display: flex;
}

Enter fullscreen mode Exit fullscreen mode

Default behavior:

The items align horizontally (row direction).

The container can adjust spacing and alignment automatically.

It helps create responsive layouts without using floats or positioning.

Top comments (0)