The flex-grow property controls how much a flex item expands when the flex container has extra space. It is a key tool for building responsive layouts that adapt to different screen sizes.
01
Grow factor
Unitless number.
02
Default 0
No growth.
03
Proportional
Ratios, not %.
04
Flex items
On children.
05
Main axis
Extra space.
06
Responsive
Fill containers.
Fundamentals
Introduction
The flex-grow property in CSS is used in flexbox layouts to define the ability of a flex item to grow relative to the rest of the flex items inside the same container. This property is a crucial part of creating responsive and dynamic layouts, as it allows flex items to expand and fill available space.
Definition and Usage
Apply flex-grow on flex items inside a container with display: flex. Use higher values when an item should take more leftover space — for example, a main content area with flex-grow: 1 and a fixed sidebar with flex-grow: 0.
💡
Beginner Tip
Think of flex-grow as a share of leftover space. If one item has flex-grow: 2 and another has flex-grow: 1, the first item gets twice as much extra space.
Foundation
📝 Syntax
The syntax for the flex-grow property is simple and involves specifying a positive number, which represents the proportion of available space the item should take up relative to other flex items.
syntax.css
element{flex-grow:number;}
Here, number is a unitless value that determines how much of the available space inside the flex container the item should take up.
Basic Example
flex-grow-basic.css
.main{flex-grow:1;/* fills leftover space */}
flex-grow: 0;flex-grow: 1;flex-grow: 2;
Default Value
The default value of the flex-grow property is 0, which means the flex item will not grow and will only take up the space it needs based on its content.
Syntax Rules
Apply on flex items, not on the flex container.
Accepts non-negative numbers (0, 1, 2, etc.).
Values are proportional ratios, not percentages or pixel sizes.
The property is not inherited.
Works along the main axis only (row or column depending on flex-direction).
Cheat Sheet
⚡ Quick Reference
Question
Answer
Initial value
0
Applies to
Flex items
Inherited
No
Value type
Unitless number (grow factor)
Common pattern
flex-grow: 1 on main content
Reference
💎 Property Values
Value
Description
number
A unitless value that represents the flex grow factor. A value of 0 means the item will not grow. Positive integers specify how much the item will grow relative to the other flex items.
How grow factors divide space
If three items have grow values of 1, 2, and 0, and the container has 300px of leftover space, items 1 and 2 share that space in a 1:2 ratio (100px and 200px). Item 3 gets none because its grow factor is 0.
Preview
👀 Live Preview
Three items with flex-grow: 1, flex-grow: 2, and flex-grow: 0 — the green item grows twice as much as the red one:
123
Hands-On
Examples Gallery
In this example, we’ll create a flex container with three items. The second item will be set to grow twice as much as the first item, while the third item will not grow — plus equal growth, sidebar layouts, and search bars.
📈 Proportional Growth
Start with the reference example — different grow factors sharing leftover space.
Example 1 — Proportional Grow Factors
Item 1 grows once, Item 2 grows twice as much, and Item 3 stays at its natural width.
The input grows to use all available width; the button keeps only the space it needs.
A11y
♿ Accessibility
Do not rely on flex-grow alone for reading order — keep logical DOM order for screen readers.
Ensure grown content remains readable at very wide or narrow sizes.
Test keyboard focus when items resize on different viewports.
Use semantic elements like main and aside in sidebar layouts.
Pair with min-width on inputs so text fields do not become too narrow on small screens.
🧠 How flex-grow Works
1
Container has extra space
After flex-basis and content sizes are calculated, leftover space remains along the main axis.
Free space
2
Grow factors are summed
Only items with flex-grow greater than 0 participate in sharing leftover space.
Ratios
3
Space is distributed
Each item receives a share proportional to its grow factor relative to the total.
Distribution
=
📈
Flexible responsive layout
Items expand to fill the container without fixed widths on every element.
Compatibility
🖥 Browser Compatibility
The flex-grow property is widely supported in modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. It is well-supported across both desktop and mobile browsers, making it a reliable choice for responsive design.
✓ Baseline · Universal support
flex-grow everywhere
All grow factor values work consistently in every modern browser as part of standard Flexbox.
99%Universal support
Google Chrome29+ · Desktop & Mobile
Full support
Mozilla Firefox28+ · Desktop & Mobile
Full support
Apple Safari9+ · macOS & iOS
Full support
Microsoft Edge12+ · All versions
Full support
Opera17+ · Modern versions
Full support
flex-grow property99% supported
Bottom line:flex-grow is safe for all modern projects. Combine with flex-shrink and flex-basis for full control.
Wrap Up
🎉 Conclusion
The flex-grow property is an essential tool for web developers working with flexbox layouts. It provides a simple and effective way to control the distribution of space among flex items, allowing for the creation of flexible and responsive designs.
By understanding and utilizing this property, you can enhance the layout and adaptability of your web projects.
Use flex-grow: 1 on main content areas in sidebar layouts
Combine with flex-shrink and flex-basis for predictable sizing
Use proportional values (1, 2, 3) when items need unequal shares
Set min-width: 0 on flex items that contain long text
Prefer the flex shorthand when setting all three values together
❌ Don’t
Apply flex-grow on the flex container instead of its children
Treat grow values as percentages — they are ratios
Expect growth when the container has no extra space
Use very large grow numbers without reason — ratios matter, not absolute values
Forget that items with flex-grow: 0 never receive leftover space
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about flex-grow
Use these points when distributing space in Flexbox layouts.
5
Core concepts
📈01
Grow factor
Unitless number.
Purpose
002
Default 0
No growth.
Default
📊03
Proportional
Ratios, not %.
Key rule
📂04
Flex items
On children.
Target
🛠05
Main axis
Extra space only.
Behavior
❓ Frequently Asked Questions
The flex-grow property defines how much a flex item should expand relative to other items when there is extra space in the flex container along the main axis.
The default value is 0, which means the item will not grow and only takes up space based on its content and flex-basis.
An item with flex-grow: 2 receives twice as much of the leftover space as an item with flex-grow: 1. The values are proportional ratios, not percentages.
No. flex-grow applies to flex items (children), not the flex container itself. The parent needs display: flex or display: inline-flex.
flex-grow only controls growth. The flex shorthand can set flex-grow, flex-shrink, and flex-basis together in one declaration.