<div class="ptest"> <div class="ptest-inner"> </div> </div> .ptest { width: 200px; position: relative; height: 0; padding-bottom: 60%; } .ptest-inner { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #333; }
<div class="ptest"> <div class="ptest-wrap"> <div class="ptest-inner"> </div> </div> </div> .ptest { width: 200px; position: relative; } .ptest-wrap { padding-top: 60%; } .ptest-inner { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #333; }
https://stackoverflow.com/questions/8894506/can-i-scale-a-divs-height-proportionally-to-its-width-using-css