1
I have two pages. One index.php and the other is called menu.php.
As the menu is the same and I repeat it on several pages I preferred to do it in a separate document and then add it with the include ("menu.php")
. Only every time I use it there’s a space, like in the following picture.
And if I add more include space repeats itself, see:
When I look at the source code " " I don’t even know where it came from.
I could insert the excerpt from the code here however this problem I only have when I use include, now if I assemble the whole structure of index.php in the same page this problem does not happen.
index.php page code
<html xmlns="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 code.php
<div class="men">
</div>
code of the general.css
@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}
I tested here and this normal. it may be some apache configuration.
– Alan Rezende
I read about the problem. The problem is that depending on the operating system, by including a php file in another php file, the file itself creates invisible characters, and these characters are interpreted by the browser generating this space in the layout. As soon as I find an answer that’s really useful I’ll post it here.
– ivan veloso
Have you tried your CSS code:
html,body {margin:0;padding:0;}
and see the results?– Corvo
You could provide the full code of the.php menu and analyticstracking.php ?
– jlHertel
Man, this question deserves all the credit, because a lot of people have broken their heads with this.
– Wallace Maxters