My DIV is not pasted into the top bar of the browser

1

My DIV is not pasted into the top bar of the browser. I realize there is a space of about 10px.

I have already used the following CSS, but it did not work at all:

body{
margin: 0;
padding: 0;
}

More codes follow:

/* CSS Document */
body{
margin: 0;
padding: 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;
}
.guaraparivirtual-topo-1 {
position:relative;
width:200px;
height:110px;
float:left;
}
.guaraparivirtual-topo-2 {
position:relative;
width:300px;
height:110px;
font-family:arial;
font-size:16px;
text-align:left;
line-height:110px;
float:left;
}
.guaraparivirtual-topo-3 {
position:relative;
width:400px;
height:110px;
float:left;
}
.guaraparivirtual-topo-3-1 {
position:relative;
width:450px;
height:35px;
float:left;
border-bottom:1px dotted #cccccc;
}
.guaraparivirtual-topo-3-2 {
position:relative;
width:450px;
height:70px;
float:left;
font-family: Arial, Helvetica, sans-serif;
    font-size: 18px;
    color:#23126E;
    text-align:center;
    line-height:59px;
}
.input-busca-guia{
    font-family: Arial, Verdana; 
    font-size: 15px; 
    padding: 8px; 
    border: 1px solid #ECECEC; 
    color: #666666; 
}
    
asked by anonymous 12.05.2016 / 17:58

2 answers

0

I usually use the code

*{margin:0; padding:0}

instead of putting it in the body as specified in your code. I'm not saying this is a better option. But it is the option that I prefer to use because by default the browser elements have standard margin that can vary from one browser to another. So I'd rather reset the margin and the padding I want for the elements.

    
13.05.2016 / 14:50
0

I am a beginner, I do not know if this is considered a "gambiarra", but if you by the main div : -8px; it is stuck to the top, for example:

.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;
    border: 1px red solid;
    top: -8px; // Mudança aquii 
}

And for other divs if you want them to be of the same height, just put position: relative and top: 0px / strong>;

    
13.05.2016 / 16:35