Flexbox
CSS Flexible Box Layout
A one-dimensional layout model for distributing space and aligning items in a row or column.
التفاصيل التقنية
The Flexbox layout algorithm distributes space along a main axis and aligns items along the cross axis. Key properties: flex-grow (expansion ratio), flex-shrink (shrinking ratio), and flex-basis (initial size before distribution). The shorthand 'flex: 1' expands to 'flex: 1 1 0%'. Gap property replaces margin hacks for spacing. Flexbox excels at navigation bars, card rows, centering content, and any layout where items share a single axis.
مثال
```css
.card-container {
display: flex;
gap: 1.5rem;
flex-wrap: wrap;
justify-content: center;
}
.card {
flex: 1 1 300px; /* grow, shrink, min-width */
max-width: 400px;
}
```