在我的 php 页面中,两个 div 元素、div 标题和 div 内容之间有相当大的空间,我无法弄清楚它来自哪里或为什么在那里。
HTML:
...
<div id="header">
HEADER
</div>
<div id="content">
<h3>Login</h3>
<form action="login.php" method="post">
...
CSS:
html {
height: 100%;
}
body {
margin: 0px;
padding: 0px;
height: 100%;
width: 100%;
border-style: none;
background: black;
}
#header {
margin: 0px;
padding: 0px;
height: 15%;
width: 100%;
border-style: none;
background: #02F72F;
text-align: center;
}
#content {
margin-top: 0px;
padding: 0px;
height: 70%;
width: 100%;
border-style: none;
background: white;
text-align: center;
}
...
实现时,有一个黑色的长条在视觉上将两个 div 分开。我知道它是黑色的,因为我特地将背景更改为黑色,但是边距和填充设置为 0,我不知道为什么开头有空格。div 元素是否有默认间距,我该如何覆盖它?