I’m having trouble making my YouTube embeds responsive on my site. When I view the page on different devices or resize the browser window, the video player stays the same fixed size while everything else adjusts properly. This makes the videos look really weird and out of place.
I’ve tried changing the width and height to percentages but that doesn’t work right. The video just resizes based on its parent container which won’t change its height properly.
Here’s my current setup:
<div class="video-container">
<iframe src="https://www.youtube.com/embed/abc123" width="400" height="225"></iframe>
</div>
.video-container {
margin: 0 auto;
width: 400px;
height: 225px;
box-shadow: 10px 10px 8px rgba(0,0,0,0.6);
}
How can I make this scale properly with the rest of my page layout?