Some of our readers find themselves in a predicament when they want to center a video in WordPress. Frustrated to get the desired effect, they ask for our help to get out of this trouble. To benefit more readers who are faced with the same situation, we come out this article so that you can find one of the quickest solutions to address the problem.
Why Center a Video in WordPress?
With WordPress video feature, you can embed a video with the insertion of URL or the use of a simple shortcode. By default, however, the video you embed in WordPress will show up on the left side. This happens when the width of article area is more than that of video. What leaves on the right side is the extra white space. The reason is that WordPress cannot well read your attention for videos are external content. You will probably have such a post as below.
With the goal to beautify the default look, the adjustment of video’s width should be made to fit the content area. This is also possible with the use of HTML code.
How to Center a Video in WordPress?
There are two options available for you to upload a video through a third party. Generally speaking, you are more advised to add YouTube or other URL in post editor. This is because WordPress will automatically adapt your video to the content area. However, such is not a case with the use of embed code.
Approach 1: Add HTML Code
However, there are some instances where you must embed a video with code for one reason or another. Under this circumstance, some simple HTML should be added around the embed code. On post edit screen is a ‘text’ editor page where you should add the below HTML code.
When you preview your changes, your video will be displayed in the middle.
Approach 2: Make It Full Width
In fact, there are more than one approach to center a video in WordPress. The width of your video can be adjusted to fill the content area through the adding or change of the ‘width’ parameter.
This approach also applies to the directly uploaded videos in WordPress. Through the video shortcode, you are also able to increase the width. Here is a difference between upload and embed: whether to upload a video through a third party like YouTube. What you should do is to avoid directly uploading videos into WordPress. Embedded videos can bring more benefits to you: easier sharing, saving bandwidth for the future, getting more viewers, and delivering a better web experience. One more again, we advise you not to directly upload videos into WordPress.
It is a fact that videos can enrich your website content and catch more intention of audience. A study shows that almost 90% readers are willing to spend more time on a webpage with a video. However, too many embedded videos will be involved in much resources consumption. It is advisable to upload your hosting solution if necessary.