Include creates space in Site Layout

1

I have two pages. One index.php and the other one is called menu.php.

As the menu is the same and I repeat it on several pages I prefer to make it into a separate document and then add it with include ("menu.php") . However, whenever I use this, there is a space, as in the image below.

AndifIaddmoreincludespacerepeats,see:

When I look at the source code, there are some strange stops that I do not even know where it came from.

IcouldinsertthecodesnippetherebutthisproblemIonlyhavewhenIuseinclude,nowifImountthewholestructureofindex.phponthesamepagethisproblemdoesnothappen.

index.phppagecode

<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>

<!-- Meta Tags -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!-- Scripts -->
    <title>Home</title>
</head>
    <body>

        <!-- Google analitycs -->
        <?php include_once("includes/analyticstracking.php") ?>

        <!-- Menu -->
        <?php include_once("includes/menu.php") ?>

    </body>
</html>

<link rel="stylesheet" type="text/css" href="scripts/geral.css">

menu.php code

<div class="men">

</div>

general.css code

@charset "utf-8";
/* CSS Document */

/* Padrão Geral */
@font-face {font-family: NFO;font-style: normal; font-weight: normal; src: url(../fonte/fonte.woff); }
a{text-decoration:none; color:inherit}
*{font-family:NFO; margin:0px; padding:0px  }
body{background-color:#f4f4f4}

/* Pagina Index */

    /* Menu */
        .men{width:100%; height:60px; background-color:#2f2f2f; float:left}
    
asked by anonymous 09.12.2014 / 00:42

2 answers

3

This type of problem often happens because of document encoding.

Try opening the files used with Notepad ++ and convert to UTF-8 without BOM by choosing the option below

Select"Convert to UTF-8 (no BOM)

Just click the "Format" tab to open this option

    
09.12.2014 / 20:13
0

I found the answer in English at this link here: link

  

I found it easier to use Edit-> Set Encoding. Set it to ISO, delete the characters, save, set it back to UTF-8. No need to close and reopen the file

When configuring the encoding for ISO some characters appear at the very beginning of the page. Just delete them and set it up again for UTF-8.

Make it easier for those who use eclipse, it worked perfectly for me.

    
03.08.2017 / 20:23