如何避免身体标签产生的边框/边距? [英] How to avoid the borders/margins that arise from the body tag?

查看:121
本文介绍了如何避免身体标签产生的边框/边距?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是CSS的新手。我有一个看似简单的问题。这是一个简单页面的小提琴。
http://liveweave.com/c6j68I

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

目标是以珊瑚背景为中心显示固定的900px白色 div

The objective is to show a fixed 900px white div centered against a coral background.

我是尝试使用两个 div s maked #outerWrapper #wrapper

I've tried to achieve this using two divs 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).

如果我给正文 #outerWrapper ,再次,颜色也出现在页面的顶部和底部,这是不希望的。 (请取消注释身体的CSS以查看此内容。)

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.

请帮忙。

推荐答案

只需在CSS中添加正文的样式,并将边距设置为0px,如下所示:

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

body {
    margin: 0px;
}

这篇关于如何避免身体标签产生的边框/边距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆