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

Undefined gap/space below my page

I recently discovered that there was a wide gap below my page and I do not know what was causing this. I tried using Firebug and I discovered that it was my #wrapper div that has this wide gap (possibly padding) in the bottom. However, I didn't specify any wide gap below my page except for a margin-bottom of 30px. Also, I tried looking at my page on my tablet and surprisingly, there was no wide gap to be found. I tried using both Firefox and Chrome on my desktop and they both show the same issue. Is this a browser default? Has anyone encountered the same issue?

I tried accessing my site using my LAN connection and the space was gone. Then I tried using my 3G dongle (which is a different network) and the space was back. I think this has something to do with my network :S

4 Answers

Please link to the web page in reference and, if you can provide it, a sample of the code used for the issue in question. Thanks!

Check the bottom margin on the last element on your page (the p tag in your footer).

The #footer p is working as expected. The div#wrapper is the one causing the problem.

James Barnett
James Barnett
39,199 Points

Edward Palomo - There's no gap per se instead there's no more content to fill the screen.

To change this I move the #footer element outside of the #wrapper element & then position it at the bottom of the page with position: absolute

Here I made a codepen to show you

/* position the footer at the bottom of the page */
#footer p {
  position: absolute;
  bottom: 0;
}

/* center the footer on the page, since it's no longer inside the wrapper*/
#footer { 
  margin: 0 auto;
  width: 940px;
}

James Barnett - I appreciate the help! :)

However, I think I know the culprit now. It seems that my (3G) network was injecting some sort of script below the page causing the gap.