Why do vertical margins disappear when the parent is set to overflow:visible? If it's set to overflow:hidden margins are visible again. It seems counterintuitive.
I think I understand how overflow is supposed to work when content of an element can't fit into it, but I don't understand what is happening with the margins.
Here's an example: ( http://jsfiddle.net/VrVc7/ )
#outer {
background-color:#EEE;
overflow:hidden;
}
#inner {
margin: 30px;
padding: 5px;
background-color:#ABE;
}
<div id="outer">
<div id="inner">abc</div>
</div>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…