简体   繁体   English

如何删除div周围的白色边框

[英]how to remove white border around the div

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. 问题是div标签上方有一个空白区域。 I can remove white space using margin: -10px; 我可以使用margin: -10px;删除空格margin: -10px; property. 属性。 But I don't like to handle it that way. 但我不喜欢这样处理。 Is there way to handle this in decent way in css? 有没有办法在css中以体面的方式处理这个问题?

<body style="margin: 0;">

将body的边距设置为0;

<body style = "margin:0">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM