我有幾個嵌套的div
塊,我的問題是最後一個left_navigation_container
的底部邊距沒有7px的間距,我不知道爲什麼(jsfiddle)。div塊的底部邊緣沒有生效
HTML:
<div class="left_navigation_outer">
<div class="left_navigation_header_outer">
<div class="left_navigation_header_logo">
<strong>Title</strong>
</div>
</div>
<div class="left_navigation_container">
</div>
</div>
CSS:
div.left_navigation_outer {
background: green;
background-repeat: repeat;
margin:10px;
-moz-box-shadow: 0px 0px 5px #ababab;
-webkit-box-shadow: 0px 0px 5px #ababab;
box-shadow: 0px 0px 5px #ababab;
}
div.left_navigation_header_outer {
background: blue;
background-repeat: repeat;
height: 50px;
border-top: 4px solid black;
}
div.left_navigation_header_logo {
line-height:50px;
color: #efefef;
text-shadow: 0 -1px #000;
text-align: center;
text-transform: uppercase;
}
div.left_navigation_container {
background: red;
background-repeat: repeat;
height: 50px;
margin: 7px;
}
我想到了這一點,但是當我應用填充時,'left_navigation_container'的邊距生效,所以我獲得了兩倍的實際空間。我可以刪除底部邊距,但我想知道爲什麼會發生這種情況。 – sooper
ahh - 用「padding-bottom」思路打我吧 –
我無法解釋它爲什麼會發生。但它不時發生,並且每次都解決它。 –