How do I remove the white space above this navbar that I created?
http://gyazo.com/b41271cad8d41c08c52ff26b1f1cab9e
I have search StackOveflow for this answer, but can't find one that seems to fix my issue. I have set html, body padding/margin to 0 as well as reset all other elements. Does anyone have any advice?
<nav id="header">
<div class="home-header">
<a href="#"><h1> testing this </h1></a>
</div>
</nav>
Here's the CSS
#header {
position: relative;
margin: 0 auto 0;
padding-top: 0px;
background-color: $main-color;
}
Setting margin on your nav to 0px and setting body padding to 0px; should works.
This is caused by a css style. By the way already a big thank you for your answers, really appreciate it! The larger breakpoint has the margin.
Step 2) Add CSS: To create a fixed top menu, use position:fixed and top:0 . Note that the fixed menu will overlay your other content. To fix this, add a margin-top (to the content) that is equal or larger than the height of your menu.
Live demo
The space at the top is create by the h1
because of its default margin. To fix this:
#header h1{
margin:0px;
}
PS: I assume that you removed the margin for the body tag. If not here's how you remove it:
body{
margin:0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With