How can you beat this moment. I upload videos from YouTube to the site, for the parent element I set the border-radius , immediately, when the page is loaded, everything is fine, the corners are rounded, but after launching the video it climbs out of the parent block.
var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); var player; function onYouTubeIframeAPIReady() { player = new YT.Player('player', { height: '160', width: '340', videoId: 'M7lc1UVf-VE', playerVars: { rel: 0, controls: 0, showinfo: 0 } }); } .player{ border-radius: 15px; } <div class="player" id="player"></div>
webkit-mask-imageandwebkit-transformas in the answer - Vadim Leshkevich