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

Julia Conlan
Julia Conlan
10,189 Points

Sticky footer for all pages

How can I have my footer stick to the bottom of the page for all of my pages.

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Julia Conlan | Personal Trainer and Group Exercise Instructor </title>

<link rel="stylesheet" href="css/normalize.css">

<link href="https://fonts.googleapis.com/css?family=Slabo+27px|Source+Sans+Pro|Zilla+Slab" rel="stylesheet" type='text/css'>

<link rel="stylesheet" href="css/main.css"> <link rel="stylesheet" href="css/responsive.css"> <meta name="viewport" content="width=device-width, initial-scale=1.0">

</head> <body>

<div class="wrap">

<header>
<a href="index.html" id="logo">
        <h1>Julia Conlan</h1>
        <h2> Personal Trainer and Group Exercise Instructor</h2>
</a>
<nav>
    <ul>
    <li> <a href="index.html">Home</a></li>
    <li> <a href="about.html">About</a></li>
    <li> <a href="contact.html">Contact</a></li>
    <li> <a href="services.html">Services</a></li>
</ul>
</nav>
</header>

<div id="wrapper">

    <img src="img/pic.jpg" alt="Photograph of Julia" class="profile-photo">

<p>Hey there! My name is Julia and I am a ACE Certified Personal Trainer and Group Exercise Instructor. </p>
<p>I started my fitness journey when I was teenager, running long distance for my High School Track team. From there I continued to pursue running and explore other ways to keep fit and active including taking part in indoor cycling classes and TRX suspension training. </p>

<p>I would appreciate the opportunity to connect with you to help you identify your fitness goals and outline a plan for your success to achieve the body you want with a workout you enjoy.</p>

</div>

<footer>
    <a href="http://twitter.com/nickrp">
    <img src="img/twitter-wrap.png" alt="Twitter Logo" class="social-icon"></a>
    <a href="http://facebook.com/nickpettit">
    <img src="img/facebook-wrap.png" alt="Facebook Logo" class="social-icon"></a>
<p>&copy; 2017 Julia Conlan.</p>
</footer>
</div>

</body> </html>

David Moody
David Moody
19,302 Points

In HTML add a class like "wrap" to the main div that excludes the footer. So the rest of the page is in this div, but not the footer. Like this in HTML:

<div class="wrap">

Then mark the min-height in CSS for the class "wrap" with the calc() function. You would calculate 100 percent of the viewer height (vh) and subtract the pixels for the footer (somewhere around 75 px, but it will depend upon how big you need your picture to be). The code would look like this in CSS:

.wrap {
      min-height: calc(100vh - 75px);
}

The website CSS Tricks has a link about five ways to do a sticky footer: https://css-tricks.com/couple-takes-sticky-footer/