Course contentsShow
← Web Development
Lesson 284 of 2,9825. FlexboxFree lesson

Common flex Shorthand Values

Master practical patterns like flex: 1, flex: auto, and flex: none.

Common flex Shorthand Values

You'll learn the most useful flex shorthand patterns that cover 90% of real-world flexbox scenarios.

In the previous lesson, you learned that flex is shorthand for flex-grow, flex-shrink, and flex-basis. Rather than remembering all three values every time, CSS provides practical presets that handle common layout needs with a single keyword or number.

The Three Essential Patterns

flex: 1

What it means: flex-grow: 1, flex-shrink: 1, flex-basis: 0%

This tells an item: "Take up an equal share of available space with your siblings." If three items all have flex: 1, they'll each occupy one-third of the container, regardless of their content size.

Perfect for: Equal-width columns or buttons in a toolbar.

flex: auto

What it means: flex-grow: 1, flex-shrink: 1, flex-basis: auto

This says: "Grow and shrink as needed, but start from my natural content size." Items respect their initial width/height before distributing extra space.

Perfect for: Navigation links or cards that should grow but maintain proportional sizing.

flex: none

What it means: flex-grow: 0, flex-shrink: 0, flex-basis: auto

This declares: "Keep my natural size no matter what." The item won't grow or shrink—it's rigid.

Perfect for: Icons, logos, or fixed-width sidebars that shouldn't change size.

Think of It Like Water Distribution

flex: 1 gives everyone equal cups regardless of thirst. flex: auto gives based on how thirsty each person started. flex: none means "I brought my own bottle—don't pour me anything."

Key Takeaway: Use flex: 1 for equal sizing, flex: auto for proportional growth, and flex: none for fixed sizing—these three patterns solve most flexbox layout challenges.