A Beginner’s Guide to Center Align a Video Snippet Embedded in WordPress
For no reason whatsoever, WordPress always seems to left-align the video within a post, if the width of the video is less than the width of the post. Apart from being aesthetically unyielding, the default option also stops you from trying other alignments, like center align a video.
Whether you are embedding a video from an external source or directly uploading within a post, it is always aligned to the left by default. It is largely because there is no special preference given to video alignment in WordPress code, so the alignment is left, same as other objects. However, it can be changed if you know how.
How to Center Align a Video?
The most straightforward way to center-align a video in WordPress is too simple to be true. All you need to do is use the video URL (from any video hosting site like YouTube) instead of the embed code and directly paste it into the post. Upon this, WordPress will try to fit the width of the video, which is as good as center alignment.
However, sometimes it is necessary to use an embed code, largely because URLs could be dynamic and change over time. In such cases, the simple way out is to use some HTML code to tinker with your embed code.
To do that, switch from visual to the text editor. Around the embed code you have pasted, use HTML code to set text alignment as center.
Sometimes, to center align a video is not enough; you need it to fit the page perfectly. For that purpose, you can change the width of the video manually. Simply go to the embed code and change the width parameter as per your need. In case you are uploading the video directly, go to the video code (once the video has uploaded) and change the width parameter.
It is practically really easy to center align a video in WordPress; all you need to know is the right trick.