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 extra line breaks in my page thanks to php include()
or maybe it is just some faulty css.
Solution: You can use one of the following: Answer1: The * selector means, select all elements and set their margin and padding to 0.
The ctype_space() function in PHP check for whitespace character(s). It returns TRUE if every character in text creates some sort of white space, FALSE otherwise. Besides the blank character this also includes tab, vertical tab, line feed, carriage return and form feed characters.
Whitespaces are generally ignored in PHP syntax, but there are several places where you cannot put them without affecting the sense (and the result).
PHP is whitespace insensitive PHP whitespace insensitive means that it almost never matters how many whitespace characters you have in a row. one whitespace character is the same as many such characters.
I got it! I must admit, this was a very strange one.
This was my exact problem, and his solution fixed it perfectly.
The problem was because of the include()
.
When you save a page as UTF-8, a special signature called a byte-order mark (or BOM) is included at the beginning of the file, indicating that it is a UTF-8 file. You can only see BOMs with low level text editors (such as DOS edit). You need to remove this signature from the included file in order to get rid of the white space at the top of the page.
In Notepad++ you can change the encoding of the file to "UTF-8 without BOM" from the "Encoding" menu. This fixes the problem for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With