这似乎根本不像溢出的目的:隐藏.显然溢出:隐藏导致元素以某种方式不同地查看他们的孩子.我真正想要了解的是这有什么区别.直观地说,它应该只使元素小于原本的元素,从不更大,我不明白它为什么会影响布局层次结构.
任何人都可以解释为什么这将是正确/必要的行为,或者这只是一个浏览器怪癖?他们的另一个方面是我失踪的溢出物吗?两种解决方案都比另一种更好吗?
编辑:我发现设置溢出:auto也是如此,所以它似乎不是溢出的重要值,只是它设置了.我还是不明白为什么.
解决方法
Floats,absolutely positioned
elements,inline-blocks,table-cells,
table-captions,and elements with
‘overflow’ other than ‘visible’
(except when that value has been
propagated to the viewport) establish
new block formatting contexts.In a block formatting context,Boxes
are laid out one after the other,
vertically,beginning at the top of a
containing block. The vertical
distance between two sibling Boxes is
determined by the ‘margin’ properties.
Vertical margins between adjacent
block Boxes in a block formatting
context collapse.In a block formatting context,each Box’s left outer edge touches the left edge of the containing block (for right-to-left formatting,right edges touch). This is true even in the presence of floats (although a Box’s line Boxes may shrink due to the floats),unless the Box establishes a new block formatting context (in which case the Box itself may become narrower due to the floats).