css - .clearfix:after中为什么设置display: table
怪我咯
怪我咯 2017-04-17 11:30:45
0
4
1015

相较于display: block;有什么优点吗?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(4)
大家讲道理

In fact, setting display: table actually uses the parent container to form a BFC
and display: block does not clear the float. It uses clear: both to clear the float.
It is recommended to take a look at this article, if you are interested, you can also study BFC
CSS Clear Float (Clear and BFC)

刘奇

display:block will cause line breaks

黄舟

display:table will clear the floating elements before and after, but block will not

Ty80

Prevent margin merging

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template