Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

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


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.