Previous: Gaps Next: Dice Build See Finish

Shorthand Properties - Starting Point

Master the flex shorthand property that combines flex-grow, flex-shrink, and flex-basis into one powerful declaration!

flex-grow, flex-shrink, flex-basis (Individual)

The long way: setting each property separately

Item 1
flex-grow: 1
Item 2
flex-grow: 2
Item 3
flex-grow: 1

flex: 1 (Shorthand)

Same as: flex-grow: 1, flex-shrink: 1, flex-basis: 0%

Item 1
flex: 1
Item 2
flex: 1
Item 3
flex: 1

flex: 1 2 3 (Different Values)

flex: [grow] [shrink] [basis]

Item 1
flex: 1
Item 2
flex: 2
Item 3
flex: 3

flex: none (No Flexibility)

Same as: flex-grow: 0, flex-shrink: 0, flex-basis: auto

Flexible
flex: 1
Fixed Size
flex: none
Flexible
flex: 1

flex: auto (Flexible with Content Size)

Same as: flex-grow: 1, flex-shrink: 1, flex-basis: auto

Short
flex: auto
Medium Content
flex: auto
Much Longer Content Here
flex: auto

Mixed Flex Values

Combining different flex values for complex layouts

Sidebar
flex: none
Main Content
flex: auto
200px
flex: 0 0 200px

🎯 Common Flex Patterns

Equal Width Columns

Column 1
Column 2
Column 3

flex: 1

Sidebar Layout