Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css] 9. 什么是外边距重叠?重叠的结果是什么? #30

Open
qiilee opened this issue Sep 27, 2019 · 0 comments
Open

[css] 9. 什么是外边距重叠?重叠的结果是什么? #30

qiilee opened this issue Sep 27, 2019 · 0 comments
Labels

Comments

@qiilee
Copy link
Member

qiilee commented Sep 27, 2019

答案:

外边距重叠就是 margin-collapse。

在 CSS 当中,相邻的两个盒子(可能是兄弟关系也可能是祖先关系)的外边距可以结合成一个单独的外边距。这种合并外边距的方式被称为折叠,并且因而所结合成的外边距称为折叠外边距。

折叠结果遵循下列计算规则:

  1. 两个相邻的外边距都是正数时,折叠结果是它们两者之间较大的值。

  2. 两个相邻的外边距都是负数时,折叠结果是两者绝对值的较大值。

  3. 两个外边距一正一负时,折叠结果是两者的相加的和。

@qiilee qiilee added the CSS label Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant