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