Reputation: 89
Alright so I am trying to create a top bar of my webpage like the one at the top of this page and what my code looks like is this:
<body>
<div id="header">
</div>
<body>
and the css is
#header{
width:100%;
}
and when I look at in a browser it doesn't completely touch the sides, It's about 10px away. How do I fix the gap?
Upvotes: 1
Views: 2692
Reputation: 12933
you need to clear the default margin/padding that the browser sets on the body. Use:
body{
margin: 0;
padding: 0;
}
Upvotes: 3
Reputation: 646
css should have this!
body {
margin: 0;
}
#header {
width: 100%;
}
because default the body has some margin on it! you should remove them so the header can fill the body full!
Upvotes: 0