Last active
March 9, 2024 11:04
-
-
Save MinkiDev/f08394dffcd974cc9d5a5e9ec1a6448a to your computer and use it in GitHub Desktop.
CSS border-radius implementation for YouTube iframe embed
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
<style> | |
.div-round { | |
overflow: hidden; | |
position: relative; | |
z-index: 10; | |
-webkit-border-radius: 20px; | |
border-radius: 20px; | |
} | |
.div-round::before { | |
display: block; | |
content: ""; | |
} | |
.iframe-round { | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
z-index: 10; | |
width: 100%; | |
height: 100%; | |
border: 0; | |
-webkit-border-radius: 20px; | |
border-radius: 20px; | |
} | |
</style> | |
<div class="div-round" style="width: 640px; height: 360px;"> | |
<iframe class="iframe-round" allow="autoplay; encrypted-media; fullscreen" src="https://www.youtube.com/embed/Xjs6fnpPWy4?modestbranding=1&autoplay=0"></iframe> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
so good