Reputation:
So I have come across a problem when I tried aligning my header design fully to the top margin and the left margin. The use HTML and CSS to perform this. CSS code:
div#headerbox
{
background-color: #a56868;
width:100%;
height: 40px;
position: fixed;
display: block;
margin-top: 0px;
margin-left: 0px;
}
div#headerwrap
{
background-color: #a56868;
width:100%;
height: 40px;
position: fixed;
display: block;
}
HTML code:
<div id="headerbox">
<div id="headerwrap">
<p>TEST 123</p>
</div>
</div>
Why doesnt this code align properly to the edges on both sides as I have put the lenght of the element to be 100%? and how can I fix this?
Upvotes: 0
Views: 4946
Reputation: 660
body { margin: 0; padding: 0; }
For more information How to correctly align fixed header fully to top and left in CSS
Upvotes: 0
Reputation: 1
Mention this code is css to solve the problem
Upvotes: 0
Reputation: 996
Apply style margin:0; to the body element.
body{
margin:0;
}
For more information on margin property you can check out this page: http://www.tutorialrepublic.com/css-reference/css-margin-property.php
Upvotes: 0
Reputation: 4609
mention
*{
padding:0;
margin:0;
}
in you css file
this will prevent default padding and margin of all block elements.
Upvotes: 0
Reputation: 1126
Set the padding and margin of HTML body in CSS to zero.
body {
margin: 0;
padding: 0;
}
Upvotes: 1