I’ve been trying to add a header to my website, but I cannot get the container to fit the full width of the screen, despite the width being set to 100% or auto. It always has about a ~5px margin on both the left and right, even with margin and padding both set to 0.
HTML:
<div id="header">
<h7>
<p>Lorem Ipsum</p>
<p>Lorem Ipsum</p>
<p>Lorem Ipsum</p>
<p>Lorem Ipsum</p>
</h7>
</div>
CSS:
body div#header{
width: 100%;
margin: 0;
padding: 0;
background-color: #c0c0c0;
}
Add
to your CSS.
Browsers put default margins and/or paddings when rendering websites. With this you can avoid that.