PHP Include or Require Causes Unwanted Gap or Space

<?php include_once('yourfile.php'); ?>

This happens all the time. You have a header, navigation, or footer that you intend on including into several other PHP files, and for some reason, it keeps adding blank space. The CSS can’t explain it, but for some reason there’s a gap or extra white space included in your page.

This is typically caused by how the file is encoded. If one file is encoded in UTF-8 and another is ANSII, it takes a second for the processor to recognize this, and thus the space.

Go back and double check to see which files are encoded which way. Notepad++ has a great, simple way of encoding PHP files.

Happy Coding!

1 Comment

  • Thanks a lot!

Leave A Comment

Your email address will not be published. Required fields are marked *