🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Expert Masterclasses.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEcss

css Documentation

LOADING ENGINE...

CSS flex-grow

Control the rate of expansion. Learn how flex items fill available space.

style.css
.item {
flex-grow: 1;
}
/* Result: */
Item expands to fill space.
🚀
flex-grow.html
1 / 7
🚀

Tutor:Welcome to flex-grow. This property defines the ability for a flex item to grow if necessary. It accepts a unitless value that serves as a proportion.


Flex Mastery Tree

Unlock nodes by understanding expansion and proportions.

Concept 1: Flex Grow

The flex-grow property allows items to expand and fill available empty space in the main axis. If set to 1, items share space equally.

System Check

What happens if all items have flex-grow: 1?


Community Layouts

Share Flex Strategies

Created a complex grid using flex-grow? Share your CSS patterns.

Enjoying this guide?

Codesyllabus is 100% free and open-source. Support our mission, pay for server infrastructure, and fuel new tutorials by buying us a coffee!

CSS flex-grow Property

Author

Pascual Vila

Frontend Instructor.

The flex-grow property is a CSS flexbox property that defines the ability for a flex item to grow if necessary. It accepts a unitless value that serves as a proportion. It dictates what amount of the available space inside the flex container the item should take up.

How it Works

When a flex container has extra space (the container is larger than the combined size of all items), flex-grow determines how that space is distributed.

  • If all items have flex-grow: 1, the remaining space is distributed equally to all children.
  • If one child has flex-grow: 2 and the others have 1, the remaining space is distributed in a 2:1 ratio.
  • The default value is 0, meaning items will not grow.

Calculation

The browser calculates the free space by subtracting the total flex-basis of all items from the container width. This free space is then allocated based on the grow factors.

Best Practices

Use flex-grow in conjunction with flex-shrink and flex-basis (often via the flex shorthand) to create responsive, fluid layouts without hardcoded widths.

Flexbox Glossary

flex-grow
A number specifying how much the item will grow relative to the rest of the flexible items inside the same container.
Free Space
The empty space remaining in a flex container after the flex-basis sizes of all items are accounted for.
Main Axis
The primary axis along which flex items are laid out. If flex-direction is row, this is horizontal.
Flex Item
A direct child of a flex container. These are the elements that respond to flex-grow.