Skip to content

外边距折叠

同一 BFC 下,块级元素在垂直方向上的外边距会折叠。

  • 如果 margin 都为正数,最终 margin 为大的那个数

  • 如果 margin 都为负数,最终 margin 为绝对值大的那个数

  • 如果 margin 为一正一负,最终 margin 为正数 + 负数