I have a problem on a site that I am making. There is this line of white space at the top of my page. I can not find out where it is coming from. It might be because of extr
Well you're missing a DOCTYPE for starters... You also don't have a character encoding specified.
Aside from that, make sure that if you've saved the files as UTF-8, they must not have a BOM at the start. Also ensure that you didn't leave any empty lines (although whitespace is probably ignored, otherwise every layout I've ever written would break)
BOM Character creates that problem. Sometimes it does not create such visual character that one see. Just check the file editor settings and set to "no BOM" to prevent such blank line.
Sometimes images won't work because of this character, since the character set of image is corrupted by such character.
To avoid such situations, i). check if your Code Editor creates new file with BOM. If so, change this setting. ii). Open all the files of your code and check BOM character at start (
This problem has also bothered me for a long time, until I found a very simple solution.
This problem is caused by a BOM character, which is used to tell code page and which endian is of a text file. When you include a PHP file, this character will be included as well. Although you will not see the BOM character, but it might cause gap on your page.
My solution is here. You don't have to remove this character from files. What you have to do is like this:
<!-- <?php
include_once (dirname(__FILE__) . "/_include.php");
?> -->
Using HTML comment mark to wrap php code which includes other php files. And the BOM character will be considered as comment and will not appear on page.