爲什麼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 –