我真的想了解内在的工作,而不仅仅是使用它,并相信“它只是工作”。
当包含的元素与浮动的子元素以相同的方向浮动时,我可以理解它是如何工作的,但是overflow:hidden意味着裁剪溢出的内容(当与position:absolute / relative一起使用时)。
任何信息赞赏。
解决方法
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,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).
块格式上下文清除浮点数。资料来源:http://www.w3.org/TR/CSS2/visuren.html#block-formatting