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 CSS Layout Basics Getting Started with CSS Layout Creating a Sticky Footer

footer height

Hi, When i check in the console the footer height is not 89px but 112 px.

Also I am still getting a scroll bar when i resize the window.

Thanks

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

* {
  box-sizing: border-box;
}

body {
    line-height: 1.6;
    color: #3a3a3a;
}

p:last-child {
    margin-bottom: 0;
}

a { 
    color: #fff;
    text-decoration: none;
}

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

/* ---- Navigation ---- */

.name {
  margin: 0;
}

/* ---- Layout Containers ---- */

.container {
  padding-left: 1em;
  padding-right: 1em;
}

.main-header {
    padding: 1.5em 0;
    background: #3acec2;
}

.main-footer { 
    text-align: center;
    padding: 2em 0;
    background: #d9e4ea;
}

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

@media (min-width: 769px) {
    .container {
        width: 70%;
        max-width: 1000px;
        margin: 0 auto;
    }
.wrapper{
  min-height:calc(100vh - 89px);
}

1 Answer

Steven Webster
Steven Webster
7,152 Points

If you're using Chrome and you inspect the p within the footer (or any p on the page, for that matter), you'll notice a margin-block-start and margin-block-end value of 1em inherited from the user agent stylesheet.

It seems that this might be a quite recent addition to the user agent stylesheet because it doesn't yet appear in even the most recent version of normalize.css, and Sublime still doesn't have text-highlighting or auto-complete for it!

Anyway, set both of those values to 0 for p elements and 89px will then be the right value to subtract from 100vh.