--- title: Flex-grow --- # Flex-Grow The flex-grow property is a flexbox property that allows you to specify the allocation of free space to containers within a flex-container. It provides a solution to all that unwanted space! It'll turn your container from this

to this

What just happened? Well, we added two things to the css syntax. HTML ```html

1

2

``` CSS ```css body { display:flex; } p { flex-grow: 1; } ``` Two things happened 1. The parent container was converted into a flex-display by `display:flex` 2. The remaining "free space" was then allocated among the remaining p containers in an equal ration since each has a flex-grow property of 1. What happens if we have p containers with different flex-grow properties? Let's see an example. First let's create two paragraphs and enable display: flex; Notice a few things - The colour scheme is nice - There's some empty space to the right of the two boxes. That empty space is the "free space" that will be allocated to each of the different paragraphs later depending on their flex-grow properties. To see this in action, let's give the first one a class of "ten" and a flex-grow property of 1. Let's also give the second one a class of "twenty" and a flex-grow property of 2. Notice a few things 1. The second one's size is not double that of the first one despite having a flex-grow property that is double that of the first. 2. The entire space is filled. ( Some margins were added to the side to enable it to be seen more clearly. ) As we resize the screen, we also find that the first one shrinks at twice the speed of the second one. #### More Information: