Asked
Updated
Viewed
74.7k times

I'm going nuts. I have a gradient that I want to stretch across my screen as a background for my page header and navbar, but I have this white border around my web page. I've been trying for two days to remove this. Has anyone seen this before?

  • 0
    I‘m looking through your source code and don‘t find anything specific that should be wrong. Try the same site without the doctype tag. — partyjan
  • 0
    Hey guys, I know I'm reviving a dead thread, but I'm experiencing the same problem, and none of the suggestions I've found fix my problem, including the body css code. Any help would be awesome. I can't post a legitimate link, cuz your forum won't let me, so this is the best I can do. — HindenPeter
  • 0
    I fixed it. Pretty simple problem, there was a # before body. — HindenPeter
  • 0
    Oh ok... glad you got that fixed. — Bogey
add a comment
1

3 Answers

  • Votes
  • Oldest
  • Latest
SF
25 0
Answered
Updated

Simply add this CSS to the header area of your webpage. This will reset the margin defaults for body to be zero.

<style type="text/css">
body { 
  margin-top: 0px;
  margin-right: 0px;
  margin-bottom: 0px;
  margin-left: 0px
}
</style>
  • 0
    Thanks Spoof, it worked. That was driving me nuts. — twocent
add a comment
1
Answered
Updated

A simpler alternative that should work:

<style type="text/css">
body { 
    margin: 0;
}
</style>
add a comment
1
Answered
Updated

Or if you still want to specify the other margins use:

<style type="text/css">
body {
    margin: 0px 0px 0px 0px;
}
</style>

Going in margin order of: top, right, bottom, left (Clockwise)

add a comment
0