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
Kyle Chadha
2,257 PointsBlank page with just header.php and footer.php -- why does the footer stay at the bottom?
Referencing the point in the video "Including the Footer and Adding Additional Pages" of 'Build a Simple PHP Video.' (https://teamtreehouse.com/library/programming/build-a-simple-php-application/creating-the-menu-and-footer/including-the-footer-and-adding-additional-pages)
A bit perplexed by this... when you've newly created the shirts.php file, and it includes nothing but the header.php and footer.php -- why does the header stay at the top, and the footer stay at the bottom? What defines the white space inbetween them?
Thanks in advance... would be curious to know the reason.
3 Answers
Matt Campbell
9,767 PointsHave you got a container that starts in the header and ends in the footer with a defined height?
Israel Schulman
1,098 PointsI believe what you may be referring to is the included CSS which has a rule for the content div.
#content {min-height: 400px; background: white;}
That forces the content div to be a minimum of 400 pixels in height, which in effect pushes the footer further down the page creating that white space.
Chris Hubbard
2,253 PointsIn the simplest of terms, all PHP code does when processed is output HTML for the browser.
So for example, if your header.php file contains the code that outputs your opening and closing HTML head tags, then it will be at the 'top of the page' so-to-speak.
There is nothing special about the naming convention of header.php in PHP (outside of a structured CMS like Wordpress).
If you wanted, you could fill the header.php file with code for the footer of your page (although I would highly recommend against this).