CSS flex-grow Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Flexbox

What You’ll Learn

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.

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.

📝 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).

⚡ Quick Reference

QuestionAnswer
Initial value0
Applies toFlex items
InheritedNo
Value typeUnitless number (grow factor)
Common patternflex-grow: 1 on main content

💎 Property Values

ValueDescription
numberA 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.

👀 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:

1 2 3

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.

flex-grow-proportional.html
<style>
  .container { display: flex; }
  .item1 { flex-grow: 1; background: red; }
  .item2 { flex-grow: 2; background: green; }
  .item3 { flex-grow: 0; background: blue; }
</style>

<div class="container">
  <div class="item item1">Item 1</div>
  <div class="item item2">Item 2</div>
  <div class="item item3">Item 3</div>
</div>
Try It Yourself

How It Works

After each item takes its base size, leftover space is divided in a 1:2 ratio between items 1 and 2. Item 3 ignores extra space entirely.

Example 2 — Equal Growth

Give every column the same grow factor so they share space evenly.

flex-grow-equal.css
.column {
  flex-grow: 1;
}
Try It Yourself

How It Works

When all items have flex-grow: 1, leftover space is split equally among them.

🛠 Layout Patterns

Use flex-grow in real UI patterns like sidebars and search bars.

Example 3 — Main + Sidebar Layout

Let the main content grow while the sidebar keeps a fixed width.

flex-grow-sidebar.css
.main { flex-grow: 1; }
.sidebar { flex-grow: 0; width: 180px; }
Try It Yourself

How It Works

The sidebar stays at 180px while the main area expands to fill all remaining horizontal space.

♿ 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.

🖥 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 Chrome 29+ · Desktop & Mobile
Full support
Mozilla Firefox 28+ · Desktop & Mobile
Full support
Apple Safari 9+ · macOS & iOS
Full support
Microsoft Edge 12+ · All versions
Full support
Opera 17+ · Modern versions
Full support
flex-grow property 99% supported

Bottom line: flex-grow is safe for all modern projects. Combine with flex-shrink and flex-basis for full control.

🎉 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.

💡 Best Practices

✅ Do

  • 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

Key Takeaways

Knowledge Unlocked

Five things to remember about flex-grow

Use these points when distributing space in Flexbox layouts.

5
Core concepts
0 02

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.

Practice in the Live Editor

Open the HTML editor, change grow values on each item, and resize the container to see how space is redistributed.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful