Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Flexbox Layout Building a Layout with Flexbox Creating a Sticky Footer with Flexbox

karan Badhwar
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
karan Badhwar
Web Development Techdegree Graduate 18,135 Points

min-height

Why do we need to give min-height: 100vh; to just set the flex-grow property as well, As i tried giving the flex-grow property it was not working any reasons behind that? 2) Flex-grow property goes only along Main Axis right?

1 Answer

The min-height is not needed to make flex-grow work, (though you do have to have some sort of height specified) but it is needed to make the footer "stick" to the bottom of the page. Without specifying the min-height as 100vh, the row still grows in relation to the other containers, but it doesn't grow enough to push the footer down. If you don't specify a height at all, then everything is going to be at its minimum height to fit the content. Once a height (or min-height) is specified, then if items need to grow to reach that height, the flex-grow property indicates the amount each element grows in relation to the others. And yes, flex-grow only applies to the main axis.