新的 display
值flow-root
已添加到css规范中:
The element generates a block container box, and lays out its contents using flow layout. It always establishes a new block formatting context for its contents. [CSS2] – https://drafts.csswg.org/css-display/#valdef-display-flow-root
有many ways to create a block context,例如
overflow: hidden
。使用
display: flow-root
和overflow: hidden
包含浮点元素有什么不同?
最佳答案
如果这对您很重要,则display: flow-root
允许您的流根元素具有overflow: visible
,因为带有overflow: visible
的块框通常不会建立块格式化上下文。
关于css - 使用display : flow-root and overflow: hidden to contain floats?有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43559066/