<div id="box"> <div id="test-padding">padding</div> <div id="test-margin">margin</div> <div id="test-after">margin</div> </div>
#box { width: 500px; height: 200px; } #test-padding { width: 50%; height: 0; padding-bottom: 50%; background: #c00; } #test-margin { width: 50%; margin-top: 50%; background: #c00; border: 1px solid #000; } #test-after { width: 50%; overflow: hidden; background: #c00; } #test-after:after { content: ''; display: block; margin-top: 100%; }