CodePen

HTML

            
              <h2>Collapsing Margins</h2>
<p>Example text.</p>
            
          
!

CSS

            
              h2 {
    margin: 0 0 20px 0;
}

p {
    margin: 10px 0 0 0;
}
            
          
!

JavaScript

            
              
            
          
!
999px
Loading ..................