elikem
5/28/2014 - 10:09 PM

Maintain Aspect Ratio with CSS

Maintain Aspect Ratio with CSS

<div style="width: 100%; position: relative; padding-bottom: 20%;">
  <div style="position: absolute; left: 0; top: 0; right: 0; bottom: 0;">
    this content will have a constant aspect ratio that varies based on the width.
  </div>
</div>