Flexbox is a modern layout model in CSS that allows flexible alignment of elements in a row or column. It makes alignment, sizing, and ordering easier to handle.
Flexbox is activated with display: flex. Inside a flex container, elements are automatically arranged flexibly, with many settings available for alignment and distribution.
Property | Description |
---|---|
display: flex | Creates a flex container in which child elements are arranged flexibly. |
justify-content | Horizontal alignment, such as left, right, center, or evenly distributed. |
align-items | Vertical alignment inside the flex container. |
flex-direction | Defines the direction: row or column. |
In the following example, three elements are inside a flex container, displayed evenly distributed and centered.
With the combination of justify-content: space-around and align-items: center, the elements are evenly spaced and vertically centered.
Flexbox makes layout handling easier, especially in dynamic or responsive design.
Please sign in to ask Lara about CSS Flexbox.
Select Language
Set theme
© 2025 ReadyTools. All rights reserved.