When we embed YouTube videos, it comes in the standard size. However, the standard size of embedded YouTube videos doesn’t work in WordPress. It requires you to resize the embedded video directly in the embed code.
This guide will help you change the size of an embedded YouTube video in WordPress.
The WordPress Block Editor makes it easy to embed and resize YouTube videos. Here’s how:
If you’re using the Classic Editor, resizing a YouTube video requires adding some HTML.
Replace the YouTube URL with an iframe code to control the size:
<iframe width=”800″ height=”450″ src=”https://www.youtube.com/embed/VIDEO_ID” frameborder=”0″ allowfullscreen></iframe>
If you want more control or need a more straightforward solution, you can use a plugin to resize embedded videos.
With today’s wide range of devices, making your videos responsive to look great on any screen size is essential.
.responsive-video {
position: relative;
padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
height: 0;
overflow: hidden;
}
.responsive-video iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
<div class=”responsive-video”>
<iframe src=”https://www.youtube.com/embed/VIDEO_ID” frameborder=”0″ allowfullscreen></iframe>
</div>
This CSS ensures your video resizes proportionally on any device.
After resizing your video, always test how it looks on different devices. Use the following steps:
Final Thoughts
Inspect the embed code and make changes to resize the YouTube video. You can use any size you want in WordPress posts and pages.
Live Composer is free and open-source. We invite all the users and developers to join us in plugin development.
It's super easy to create designs or extensions for Live Composer. Sell your add-ons to 30K+ plugin users.
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More