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

Flexbox Sticky Footer...doesn't want to stick

I'm working through the last video in the Flexbox Layout Series and I can't get the

3 Answers

Branko Zivanovic
Branko Zivanovic
2,684 Points

Instead of selecting element with class .body you should just simply target body element.

body{ min-height:100vh; display:flex; flex-direction:column; } .row{ flex:1; }

sticky footer to stick. Here's a link to the video:

example link

Here's my code:

 /* ================================= 
  Base Styles
==================================== */

.body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.row {
  flex: 1;
}

/* ================================= 
  Media Queries
==================================== */

@media (min-width: 769px) {

    .main-header,
    .main-nav {
        display: flex;
    }
    .main-header {
        flex-direction: column;
        align-items: center;
    }

}

@media (min-width: 1025px) {

    .main-header {
        flex-direction: row;
        justify-content: space-between;
    }

}

I'm really not sure what I'm missing here

Thanks Branko!...I had made that mistake previously and need to catch myself on it. Appreciate it