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


White space when using php includes

Hi there, i notice that when i use includes in my files, in my case the header, it appears a white space at the top. But i no that if i change the file to UTF whitout BOM that it resolves. My question is why that this happen?

1 Answer

Hi Mauro,

UTF with BOM inserts a few bytes at the beginning of the file to indicate the encoding. This produces the whitespace in your html.

So you always want to save without BOM so you don't have those extra few bytes.

Source: http://stackoverflow.com/questions/10199355/php-include-causes-white-space-at-the-top-of-the-page