How To Center Youtube Video In WordPress Post

In latest wordpress versions, you dont need any separate plugins to embed video in a post. You can just copy paste the youtube video URL in the wordpress editor in visual mode and it will start appearing in the post. Essentially wordpress will automatically convert the URL into a YouTube embed and provide the corresponding preview in the visual editor. However, just having the video displayed is not sufficient. You might also require the video to be centered in the display area to enhance its visual appeal and make the overall content look good.

How to Center video in wordpress This however is not straight forward in the sense that the visual editor does not allow to center the video from the visual menu. If you search for a solution, a suggestion would be to align it to center using div attribute in html. However the problem is that even if you put it under the div attribute, it will show the video centered in the visual view. But the moment you update or save the post, it again starts showing up on the left ( the div does not take effect )

If you switch to the html mode, the html code appears as follows in a single line

<div align="center">YOUTUBE_VIDEO_URL</div>

Here YOUTUBE_VIDEO_URL corresponds to the actual youtube URL that you want to embed. The way to solve this problem is by using the embed shortcode. This will achieve the same result but would not bother about the positioning of the URL in the same line. So the final embed code should look like this in the html editor of wordpress.

<div align="center"> [embed]YOUTUBE_VIDEO_URL[/embed] </div>

Following is a youtube video centered using this method

Let us know if this works for you or any other method that you think can be used for centering video in wordpress post.

photo by:

Inficone runs on the Genesis Framework

Genesis Framework
Genesis empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go. It's that simple - start using Genesis now!
Follow On Twitter
Follow On Facebook
Follow Using RSS
Follow Using Email
Tweet This Post
Share Post On Facebook
Digg This Post
Stumble Upon


  1. This is a real good feature enabled by WordPress developers, initial days we need plugins which indirectly put some load & cause the site to load slowly with this things had come better

Speak Your Mind


This blog is kept spam free by WP-SpamFree.