Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@MinkiDev
Last active March 9, 2024 11:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MinkiDev/f08394dffcd974cc9d5a5e9ec1a6448a to your computer and use it in GitHub Desktop.
Save MinkiDev/f08394dffcd974cc9d5a5e9ec1a6448a to your computer and use it in GitHub Desktop.
CSS border-radius implementation for YouTube iframe embed
<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>
@yassir7566
Copy link

so good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment