1

I have a document that includes a header (menu) and a footer in PHP:

<?php include('header.php'); ?>
<?php include('footer.php'); ?>

For some reason when opened on the browser it renders a gap between both without having any margins or CSS styles doing it:

HTML gap when using php include()

This is part of the code generated, the gap appears between </header><footer>:

<div class="ClearFloat"></div>
</nav>
</header><footer>
<div class="MainWrapper">
<ul>
<li>&copy; Copyright 2013</li>

If I inspect using firebug I do see a gap in the code:

</nav>
</header>

<footer>
<div class="MainWrapper">
<ul>

Furthermore if I try to edit the code in firebug I get a weird entity number where the gap appears: &#65279;:

</nav>
</header>&#65279;<footer>
<div class="MainWrapper">
<ul>

This has to do something with php because if I write the HTML of the header and the footer straight in the page the gap disappears:

HTML gap disappears when not using php include()

Any ideas? Thanks.

multimediaxp
  • 9,348
  • 13
  • 49
  • 80
  • 1
    check accepted answer http://stackoverflow.com/questions/6538203/how-to-avoid-echoing-character-65279-in-php-this-question-also-relates-to-java – Mate Apr 04 '13 at 01:38

2 Answers2

3

As Per Why is &#65279; appearing in my HTML?

it may have a Simple Fix!

The character in question &#65279 is the Unicode Character 'ZERO WIDTH NO-BREAK SPACE' (U+FEFF) attached to your code on a copy/paste or during a faulty Save its so simple to fix that, just open that file by notepad++ and step follow --> Encoding->Encode in UTF-8 without BOM. then save that. It work for me as well!

Community
  • 1
  • 1
internals-in
  • 4,798
  • 2
  • 21
  • 38
0

The character in question &#65279 is the Unicode Character 'ZERO WIDTH NO-BREAK SPACE' (U+FEFF). It may be that you copied it into your code via a copy/paste without realizing it.

DanielGaffey
  • 107
  • 6