为什么h1,h2,h3元素边距在div中被忽略?h1,h2,h3 ..元素吃div div边缘
<div class="col">
<h3>This is header</h3>
</div>
<div class="col">
<h3>This is header</h3>
</div>
.col {
background: gray;
margin-bottom: 1em;
}
.col h3 {
margin-bottom: 1em;
}
当我把^ h元素插入DIV并且在它没有其他文字,虽然^ h元素和div元素底部的边距spicified,H底边距被忽略。
这是正确的行为,你要的是给你的'col'类'填充底:1EM;' – Brewal
我不知道什么是你试图做...但也许你正在尝试做一个填充:检查'padding-bottom:1em;'而不是。 – maqjav
您尝试忽略底部边距设置边距:-18px;在.col css –