Updated on November 04, 2019

If you are using the built-in oEmbed feature of WordPress whereby pasting the URL of a YouTube video inserts the video in your post content, adding the following CSS will make the videos take up the full available width of your content with the videos proportionately sized i.e., behave responsively:

/* Make YouTube videos inserted via WordPress oEmbed full-width */

.wp-block-embed-youtube {
	overflow: hidden;
	position: relative;
	max-width: 100%;
	height: auto;
	padding-bottom: 56.25%;

.wp-block-embed-youtube iframe,
.wp-block-embed-youtube object,
.wp-block-embed-youtube embed {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;

An example can be seen here.

Need help implementing a tutorial in your site or want to hire me for custom work?


Find the article helpful and wish to donate?



You need to be logged in to view and post comments.
Not a member yet? Join here.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: