title: Two element margin collapsed vertically then actual size?
body: <p>I am learning CSS3 from W3Schools. This note is confusing me, please help me to understand this example.</p>
  
  <p>The <code>h1</code> element has a bottom margin of <code>50px</code> and the <code>h2</code> element has a top margin of <code>20px</code>. Then the vertical margin between <code>h1</code> and <code>h2</code> should have been <code>70px</code> (50px + 20px). However, due to margin collapse, the actual margin ends up being <code>50px</code>. Why is this?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>h1 {
    margin: 0 0 50px 0;
  }
  
  h2 {
    margin: 20px 0 0 0;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;h1&gt;Heading 1&lt;/h1&gt;
  &lt;h2&gt;Heading 2&lt;/h2&gt;</code></pre>
  </div>
  </div>
  </p>