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

PHP Build a Simple PHP Application Creating the Menu and Footer Including the Footer and Adding Additional Pages

Cody Solomon
Cody Solomon
6,662 Points

Why does the closing "</div>" tag in the footer section have to be included for the web page to display correctly?

just above the class="wrapper" div, it is included. I tried not including it in the footer.php page and I had a weird layout problem where the footer displayed directly under the header. Adding it back in fixed the issue but I am just curious to know the logic behind it. Thanks!

2 Answers

Dai Phong
Dai Phong
20,395 Points

Yep, just because you have included the header.php in which you open a <div> tag, so you have to close it, in this case you can close it in footer.php because you include it in footer. And in this situation, I think </div> close for the container. Sorry for bad english, but I hope you will clear.

Ian Hilton
Ian Hilton
6,223 Points

Hi Cody, I'm not sure why Randy Hoyt didn't leave the closing div tag in the main files (index.php, and contact.php) If there's a reason I don't know what it is, but any time you leave a div open with out closing it you will get problems.

The reason the page displays correctly when you leave the closing div in the footer is that it closes the open div left over from the file (index.php) that loads above it.