Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
In web design, a sticky footer is a footer that sticks to the bottom of the page regardless of the amount of content on the page.
Sticky footer tips
If you still see a gap below the footer in browsers like Firefox and IE, or when you change the browser's zoom, give .main-footer
a height
or min-height
value of 89px
.
Resources
Video review
If a page’s content is shorter than the height of the browser, the page may display a big, undesirable gap between the bottom of the viewport and the footer. In the markup, add a new <div>
that wraps the header and main container elements.
<div class="wrap">
<div class="main-header">
<div class="container">
...
</div>
</div>
<div class="container">
...
</div>
</div> <!-- /.wrap -->
Use calc()
to write a mathematical expression that will subtract the footer height from the viewport's total height.
.wrap {
min-height: calc(100vh - 89px);
}
Related videos
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up