How do I put the div at the top of the page by tapping right at the top

Asked

Viewed 4,477 times

2

Well, I have the following code:

<style>
body{
background-image: url("imagens/fundo.png");
background-repeat: no-repeat;
background-size: cover;
}   


.logo{
margin-left:10%;    

}

.linha1{
margin-left:20%;
background-color:#ABABAB;   
height:5%;
width:20%;
margin-top:0%;
}

.online{
margin-left:60%;
margin-top:1%;
}

.jack1{
background-color:#ABABAB;   
height:5%;
width:20%;
margin-left:10%;
}

</style>
<header>
<div class="jack1">


</div>


<div class="online">
<span style="color:#a9a9a9; font-family:proxima_nova_cn_rgregular,sans-serif; font-size:18px; text-transform: uppercase;">Online:</span>
<span style="color:#a9a9a9; font-family:proxima_nova_cn_rgregular,sans-serif; font-size:17px; text-transform: uppercase;"><b>20</b></span>  
</div>





<div class="logo">
<img src="imagens/logo.png">
</div>


</header>

What I intend to do is put the div jack1, at the top of the page, really touching. Because what I’m getting is a few pixel spacing.

How can I do that?

Thank you.

  • Where is this div in HTML?

  • I updated the post, I had put the wrong code. Thank you Miguel.

1 answer

2


What you just have to do is put your body with margin: 0;, this one for default has a margin of 8px (if I am not mistaken):

body{
    background-image: url("imagens/fundo.png");
    background-repeat: no-repeat;
    background-size: cover;
    margin: 0;
}   
  • That’s right, thank you for the help Miguel, I will soon accept the answer.

  • You’re welcome @Gonçalo, I’m glad I helped, rest assured that you’ll never forget this

  • Eheheh, it is true.

Browser other questions tagged

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