Margin Collapse


#1

[https://www.codecademy.com/courses/learn-css-box-model/lessons/box-model-intro/exercises/margin-collapse?action=resume_content_item&course_redirect=learn-css]

In the above exercise, it says “Unlike horizontal margins, vertical margins do not add. Instead, the larger of the two vertical margins sets the distance between adjacent elements.”
So, what if two margins have same distance, let’s say 20px?


#2

It will still use both. If you would inspect your html using f12, we still see that both css is applied to the corresponding elements.
Its just that the browser doesn’t add the heights. So it will automaticly disable 1 of them.


#3

Thanks, it was very helpful.