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

Keith Corona
Keith Corona
9,553 Points

Sticky footer: unsure how flex-grow pushes the footer to the base - why?

In the video I watched, Guil shows us how to make a sticky footer with flexbox. Everything makes sense and was explained simply, but I am not completely understanding why using flex-grow would be successful in pushing the footer to the base of the viewport. This is the snippet of code that I am questioning. I understand that it is good syntax, but just not sure why it eliminates the gap forcing footer to the base.

.row {
     flex: 1;
}

1 Answer

flex-gow stretches the height of .row to the maximum of available space. Guil explains it on minute 2:30.

without flex-grow, the height of .row is defined by its content. with flex-grow, its takes all the available space thats left inside the viewport.

this is my favorite guide for flexbox when i need to recheck something: https://css-tricks.com/snippets/css/a-guide-to-flexbox/

hope it helps you!