Created
November 27, 2020 10:22
-
-
Save YoshiTheChinchilla/7940fa1933404aa9e94786d39f115d0b to your computer and use it in GitHub Desktop.
simple implementation in Vue.js of auto adjusting height for YouTube iFrame
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="iframe-container"> | |
<iframe class="iframe-content" src="https://www.youtube.com/embed/g06zI68Blzk"></iframe> | |
</div> | |
</template> | |
<script> | |
export default {} | |
</script> | |
<style scoped> | |
.iframe-container { | |
width: 100%; | |
/* Aspect ratio of 16:9 */ | |
padding-bottom: 56.25%; | |
height: 0px; | |
position: relative; | |
} | |
.iframe-content { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment