How to Center Align Video in WordPress

By default, when you embed a video in WordPress it is aligned to the left. This is because videos are  embedded in the content, so WordPress can’t guess how you would like to display it.

As a best practice, it automatically aligns it to the left. Leaving it up to you to adjust the alignment if needed.

It is not recommended to upload videos directly to WordPress, but the same thing will happen with uploaded videos if their width is less than your content area.

Having said that, let us show you how easily you can center align a video in WordPress.

How to Center Align Video in WordPress

If you want your video to fill the width of your content area, then the best way to do this is by adding a YouTube or Vimeo video URL directly in post editor instead of using the embed code.

By simply entering the URL, WordPress automatically tries to display the video that fits your content area.

However sometimes for one reason or another, you may need to use the embed code. In that case, you will need to add some simple HTML around your video’s embed code.

First, you need to switch to the text editor on post edit screen. After that, you need to add the following HTML code around your video embed code:

You can now save your changes and preview the post or page. Your video will be neatly aligned in the center of your content area.

2018-10-09T10:56:42+00:00Learn|