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 trialSeth Barthen
11,266 PointsWhite space underneath my footer, but only on some pages
Hello. As the title explains I'm getting some white space underneath my footer but only on some pages. It makes no sense because the coding is typically the same on each page, and I don't have any funky CSS for moving it to the bottom of the page or positioning it.
I could post all my code to show all of you what I'm working with here but I'll just write out the basic format...
<?php my header?>
my content is here
<?php my footer?>
I know that's pretty vague, but that's really all it is. I'm using bootstrap as well to help with my grid layout.
5 Answers
James Gill
Courses Plus Student 34,936 PointsSeth,
Something is different between your pages. Without seeing the actual page code, I'm not sure how someone can help you. Can you post an example of a "good" and "bad" page?
Seth Barthen
11,266 PointsCool... and the formatting is all messed up to just to add another challenge ;)
Seth Barthen
11,266 PointsCool... and the formatting is all messed up to just to add another challenge ;)
Seth Barthen
11,266 PointsI think I figured something out.... Seems like the footer will go to the bottom when there is a side scroll bar present. If the page fits all on my screen where there is no side scroll bar it seems to want to have that gap of white space underneath the footer.
Ryan Duchene
Courses Plus Student 46,022 PointsI'm pretty sure that your issue is that your page isn't tall enough to completely fill in the height of your web browser. In other words, your browser window is taller than your webpage.
There are two main ways to solve this. First, you can give your main content area (not the html
or body
element) a min-height
of 100vh
. This forces the page to be at least tall enough to make the footer stay on the bottom. For obvious reasons, this may not be desired.
You can also implement a sticky footer. A sticky footer will stick to the bottom of the page, regardless of its height. Guil shows how to make a sticky footer in this video at 2:50. This is probably what you want.
Seth Barthen
11,266 PointsSeth Barthen
11,266 PointsHaha I figured that'd be the case... Ok here goes.
Good Page:
BAD PAGE:
FOOTER PAGE:
Let me know if there is anything else I'd need to add. The CSS really doesn't do much to these pages so I didn't include it..