我将 article 标签和 header 标签之间的边距设置为 0,但我仍然看到它们之间有一个空格,显示我的正文为黄色。我正在尝试将标题和文章之间的空间最小化为 0,而不将正文中的所有元素都设置为 marin: 0
这是我的 CSS。
body
{
background-color: yellow;
margin: 0;
}
header > * {
margin: 0;
float: left;
}
header
{
background-color: white ;
width: 100%;
height: 40px;
}
article > * {
margin: 0;
}
article
{
background-color: red;
}
#search {
background-color: #a6dbed;
height: 500px;
}
#mostdesired
{
background-color: #c7d1d6;
height: 200px;
}
这是html
<body>
<header>
<h1>Welcome</h1>
<input type="text"/>
<input type="submit" value="Search"/>
</header>
<article>
<section id="search"><h2>this is the search</h2>@RenderBody()</section>
<section id="mostdesired" ><h2>This is the most section</h2></section>
</article>
</body>
最佳答案
关于html - 边距未设置为零,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24021194/