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

HTML

Alec Mompoint
Alec Mompoint
1,624 Points

Footer is not displayed at the bottom

I can't figure out why my footer is not displayed at the bottom,

index.html
<!DOCTYPE html>
<html>
  <head>
    <title>Date and Drop</title>
    <link href="https://fonts.googleapis.com/css?family=Arima+Madurai" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Arima+Madurai|Lora" rel="stylesheet">
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" href="css/normalize.css">
  </head>
 <body>
    <header>
      <h1 id="logo">Date and Drop</h1>
     <nav>
      <ul>
        <li><a href="index.html">Home</a></li>
        <li><a href="categories.html">Categories</a></li>
      </ul>
     </nav>
    </header>
      <footer id="main-footer">
        <ul>
          <li><a href="signin.html">Sign In</a></li>
          <li><a href="signup.html">Sign Up</a></li>
        </ul>
      </footer>
  </body>  
</html>

and my CSS stylesheet

main.css
/**************************
FOOTER
**************************/

#main-footer {
  width: 100%;
  clear: both;
}

#main-footer a {  
  text-decoration: none;
  float: right;  
}

#main-footer li {
  list-style: none;
  display: inline-block;
}

2 Answers

Steven Parker
Steven Parker
229,732 Points

:point_right: Do you mean at the bottom ... of the page?

There are several ways to make an element display at the bottom of the page, including: spacer elements, flex box, calculated margins, and explicit positioning.

One of the simplest to implement is to fix the position at the bottom:

#main-footer {
  /* other properties... */
  position: fixed;
  bottom: 0px;
}

This is actually a question for the CSS category rather than HTML.

Alec Mompoint
Alec Mompoint
1,624 Points

oh okay thank you I thought that the fact that it was a footer it automatically display it at the bottom of the page by default

Steven Parker
Steven Parker
229,732 Points

:information_source: footer is one of several sectioning elements, none of which have any special positioning by default. You may have more than one footer element on a page as long as they are not nested.