Skip to content

Instantly share code, notes, and snippets.

@CodeMyUI
Created February 3, 2018 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodeMyUI/b9b44647227350bc9c4cfec0c3e39ca8 to your computer and use it in GitHub Desktop.
Save CodeMyUI/b9b44647227350bc9c4cfec0c3e39ca8 to your computer and use it in GitHub Desktop.
Scalable iframe with reproCSS
<h1>Scalable iframe</h1>
<iframe id="demo" width="560" height="315" src="https://www.youtube.com/embed/XreMtQz6HkY" frameborder="0" allowfullscreen></iframe>
<style process="load resize">
#demo {
width: 100%;
height: calc(${document.querySelector('#demo').offsetWidth}px / (${demo.width}/${demo.height}));
}
</style>
<footer>Built with <a href=https://tomhodgins.github.io/reprocss/>reproCSS</a> </footer>
<script src="//rawgit.com/tomhodgins/reprocss/master/reprocss.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment