Html 如何删除div周围的白色边框
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14540102/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to remove white border around the div
提问by newday
I am trying to develop a web site from scratch. Here is the code
我正在尝试从头开始开发一个网站。这是代码
<html>
<head>
</head>
<body >
<div id="top" style="height:200px;background-color:green">
</div>
<div id="middle" style="height:800px;background-color:white">
</div>
<div id="footer" style="height:200px;background-color:green">
</div>
</body>
</html>
Problem is that there is a white space around above div tags. I can remove white space using margin: -10px;
property. But I don't like to handle it that way. Is there way to handle this in decent way in css?
问题是 div 标签上方有一个空白区域。我可以使用margin: -10px;
属性删除空格。但我不喜欢那样处理。有没有办法在 css 中以体面的方式处理这个问题?
回答by Cobra_Fast
<body style="margin: 0;">
<body style="margin: 0;">
回答by Zelal
Set the margin for the body to 0;
将正文的边距设置为 0;
<body style = "margin:0">