CSS Style not reaching edges
-
27-05-2021 - |
Question
On my website, the header is a div tag with a coloured background. The only problem is that it doesn't reach the "edges" of the window (Please see http://manpoints.uk.to/).
Any ideas of how to solve this?
Thanks, Josh.
Solution
Try what @KP is suggesting, plus add #header{ width:100%; }
to your stylesheet. What's happening is that your header does not have a defined width, and it's taking te maximum width of the content inside.
OTHER TIPS
This is a browser default css.
Add this to the head
<style>
body{
margin:0;
padding:0;
}
</style>
Or add it to a style sheet.
You may want to consider using a CSS reset
technique to clear all browser-set styles. Your issue is that body
by default has margin
and padding
.
In your stylesheet be sure to clear them by:
body
{
margin: 0;
padding: 0;
}
See this question for relevant CSS reset stylesheets: https://stackoverflow.com/questions/116754/best-css-reset