Snowman Snowman - 3 months ago 5
CSS Question

How to avoid the borders/margins that arise from the body tag?

I'm new to CSS. I've got a deceptively simple problem. This is a fiddle of a simple page.
http://liveweave.com/c6j68I

The objective is to show a fixed 900px white

div
centered against a coral background.

I've tried to achieve this using two
div
s maked
#outerWrapper
and
#wrapper
.

However, the whole page still seems to have a white background, which seems to be connected to the
body
tag. (Please use the fullscreen mode to see it).

If I give the
body
the background color of the
#outerWrapper
, again, the color appears on the top and bottom of the page too, which is undesired. (Please uncomment the CSS of body to see this.)

I've tried using the article tag; using negative margins; and changing dimesions of the body tag. Nothing seems to work.

In simple terms, a want a 'columned' look: coral-white-coral; instead of the 'boxed' look I currently have.

Please help.

Answer

Just add a style for the body in your CSS and set the margin to 0px, like so:

body {
    margin: 0px;
}
Comments