http://i.stack.imgur.com/OwMiA.png
<head>
<style>
body {
background-color : gray ;
}
.center {
margin-top : 0px ;
background-color : white ;
border-left : 2px solid black ;
margin-left : 50px ;
margin-right : 50px ;
}
</style>
</head>
<body>
<div class="center">
<p>a</p>
</div>
</body>
任何人都可以帮助解决如何删除顶部空间,这样主体看起来就像顶部没有空间一样。感谢您的帮助
最佳答案
添加这个*{margin:0; padding:0;}
将删除浏览器提供的默认 margin
和 padding
关于html - CSS - 不要在顶部制作线条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27873215/