{"id":21202,"date":"2013-04-18T03:05:55","date_gmt":"2013-04-18T10:05:55","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=21202"},"modified":"2021-08-04T07:56:47","modified_gmt":"2021-08-04T14:56:47","slug":"flex-grow","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/f\/flex-grow\/","title":{"rendered":"flex-grow"},"content":{"rendered":"\n

The flex-grow<\/code> property is a sub-property of the Flexible Box Layout module<\/a>.<\/p>\n\n\n\n

It 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.<\/p>\n\n\n\n

.element {\n  flex-grow: 2;\n}<\/code><\/pre>\n\n\n\n

For example, if all items have flex-grow<\/code> set to 1, every child will set to an equal size inside the container. If you were to give one of the children a value of 2, that child would take up twice as much space as the others.<\/p>\n\n\n

Syntax<\/h3>\n\n\n
flex-grow: <number><\/code><\/pre>\n\n\n

Demo<\/h3>\n\n\n

The following demo shows how the remaining space is being calculated according to the different values of flex-grow<\/code> (see on CodePen for better understanding).<\/p>\n\n\n\n