Skip to content

Instantly share code, notes, and snippets.

@kdaisho
Created October 2, 2023 01:53
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 kdaisho/586dec414f79cf3abb9b70896b909976 to your computer and use it in GitHub Desktop.
Save kdaisho/586dec414f79cf3abb9b70896b909976 to your computer and use it in GitHub Desktop.
responsive layout - iframe
<style>
/* scss */
.iframe-container {
overflow: hidden;
position: relative;
width: 100%;
&:after {
content: '';
display: block;
padding-top: 56.25%;
}
iframe {
left: 0;
position: absolute;
top: 0;
width: 100%;
height: 100%;
}
}
</style>
<div class='iframe-container'>
<iframe
style='border:0;'
src='https://www.youtube.com/embed/nKIu9yen5nc?start=149'
width={IFRAME.WIDTH}
height={IFRAME.HEIGHT}
frameborder='0'
></iframe>
</div>
<script>
const IFRAME = {
HEIGHT: 382,
WIDTH: 680,
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment