如何避免身体标签产生的边框/边距? [英] How to avoid the borders/margins that arise from the body tag?
问题描述
我是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 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).
如果我给正文
#outerWrapper $ c的背景颜色$ c>,再次,颜色也出现在页面的顶部和底部,这是不希望的。 (请取消注释身体的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屋!