How do I delete the space that require_once leaves?

Asked

Viewed 134 times

2

When I use the require_once to include the top of the site, it leaves a top space at the top of approximately 8px, even in CSS I using body{ padding: 0; margin: 0; border: 0; }; the problem remains.

Follow my full CSS code:

body{
    padding: 0;
    margin: 0;
    border: 0;
}
.guaraparivirtual-topo {
position:relative;
width:1215px;
height:110px;
background-image:url(http://guaraparivirtual.com.br/novo-gv/logo.png);
background-repeat:no-repeat;
background-position:1% 50%;
margin: 0 auto;
background-color:#D5D5D5;
}

Now follow the full HTML and with the require_once:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="pt-br">
<meta name="description" content="Guarapari, Cidade Saude, guarapari es, espírito santo, fotos, verão, sol, mar, praias, tv, comidas tipicas, telefones úteis, horario de ônibus, turismo rural, empresas.">
<meta name="keywords" content="Brasil, Brazil, Guarapari, Cidade Saude, guarapari es, guarapari espírito santo, guarapari fotos, guarapari brasil, verão em guarapari">
<meta name="Author" content="Gladison Luciano Perosini" />
<meta name="reply-to" content="[email protected]" />
<meta name="robots" content="Follow" />
<title>:: Guarapari Virtual :: O Site da Cidade Saúde - Guarapari-ES</title>
<link href="guarapari-css.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="fonte.css">

</head>

<body>
<?php require_once('guarapari-topo-site-virtual.php'); ?>
</body>
</html>

It also follows the content of require_once:

<div class="guaraparivirtual-topo"></div>

All the files are there, but I couldn’t find the problem.

If I take the contents of the inclusion file and put right on the page it works neatly and without the top space, but and I use the inclusion file it gives this space.

Can you help me?

I await and thank you

  • have to put only the beginning of the page Uarapari-top-site-virtual.php ?

  • @Victorgomes better explain to me what I should do

  • Look just so there are no spaces for mistakes (even though I believe that is not the problem) eliminate the spaces, before <link..> e </head> e <body>

  • @Victorgomes I did what guided me and it didn’t work

  • If I take the contents of the inclusion file and put right on the page it works neatly and without the top space, but and I use the inclusion file it gives this space.

  • 1

    See if the file condition is the same. Try to save everything encoded as UTF-8 without BOM

  • @Gladisonneuzaperosini mark an answer as correct or add more information.

Show 2 more comments

2 answers

1

I believe that the functions can be used top and position to "reinforce" the position at the top of the page.

I will give a small and simple example in the use of these functions, the example can be seen here or below.

div {
    width: 200px;
    height: 50px;
    margin-left: -100px; /* metade da largura */
    margin-top: 0px; /* metade da altura */
    position: absolute;
    top: 0%;
    left: 50%;
    border: 1px solid blue;
}
<div>
    Topo absoluto
</div>

The "secret" is no position: absolute; and in the margin-top with the combination of top

0

I tested exactly as you have. Here is the image of my monitor:

inserir a descrição da imagem aqui

I think you must have a margin/padding somewhere and you haven’t noticed, or maybe you have some property that acts on all div

  • I checked everything you requested and nothing. rss Continues top space.

  • If I take the contents of the inclusion file and put right on the page it works neatly and without the top space, but and I use the inclusion file it gives this space.

  • Strange to be like this in your browser. Here I am with two computers in the office and the top space remains. Rss

  • Maybe you have some property that acts on all the div and not repaired. I have to inspect the element in your browser and see if you can find out where it’s coming from. Right-click the browser and click Inspect element, or Ctrl+shift+i

Browser other questions tagged

You are not signed in. Login or sign up in order to post.