Hit enter to search or ESC to close
Thinking WordpressThinking WordpressThinking Wordpress
  • Tips n’ Tricks
  • Guides
  • Plugins
  • WordPress
  • Developing
  • SEO tips
  • Server
How Do I Center a YouTube Video in WordPress?
Wordpress

How Do I Center a YouTube Video in WordPress?

By John Allen May 18, 2022 No Comments

If you run a WordPress powered website you have probably wanted to embed a YouTube video at one time or another. Video can add interactivity and excitement to a blog post. Luckily, WordPress and YouTube make this a very easy process. Centering your YouTube video can be a bit tricky though, especially if you don’t know any coding. This article will teach you a very simple fix though. It will ensure you can center any YouTube video, or any object at all, for that matter.

First you have to get the video into your post. You go to YouTube, click embed (under video), choose your options and copy the HTML code. You then take that code and paste it into the WordPress visual editor. Remember you have to set to HTML, using the button in top right corner. Then you simply paste in your YouTube embed code. Now you have the video in your post or page.

Once you have that done you can switch back to the visual tab on the WordPress editor. You will see your video (or object) as a large yellow box. Ideally, you could simply click on that box and click the center button on the editor. Unfortunately, that doesn’t work. I am not sure exactly why, but it is probably because the center command in WordPress inserts HTML code that the object doesn’t recognize. For example, even if you switched back over to the HTML editor and wrapped the object in < center > tags, it won’t work.

The fix is pretty simple though. You just have to navigate back to the HTML part of your editor. You won’t see the yellow box now you will see the embed code for the video. Right before the embed code, enter:

div style = &#8220;text-align:center;&#8221; (in between html brackets of course, removing spaces around the enter symbol)

And then after the end of the embed code:

/div (also between html brackets)

When you switch back to your visual editor you will notice the yellow box is centered! Now that you have learned this code you can center any YouTube video or other object in each of your posts. Use it often enough and it won’t be long until you have the code memorized. If you aren’t comfortable with HTML, then write the above code down right now. If you are at your computer, add it to a text file so you can copy and paste easily. Try it on your next blog post and let me know how it works.

HI! MY NAME IS YIANNIS
I live in Athens, Greece. I'm thinking and using Wordpress for the last 10 years. Every day, I learn something new and I'm here to share it with people who care.

What’s Trending

  • Link Building Tricks With CommentLuv and KeywordLuv May 26, 2021
  • How to build a WordPress starter package June 7, 2020
  • How to reduce your wordpress size April 16, 2020

Recently Written

  • MySQL Admin Password and Plesk Parallels 10Check What Is Best For You: Dedicated Server or VPS Server? March 13, 2023
  • 5 Simple Steps to Choose WordPress HostingSmall Business Web Hosting: What Is Grid Hosting? March 12, 2023
  • MySQL Admin Password and Plesk Parallels 10Do You Know Cloud Computing and Cloud Hosting? March 11, 2023
  • Previous PostTOP 10 Digital Marketers of 2018

  • Next PostAdvantages of Building a Website Or Blog on WordPress

You May Also Like

Thinking of Updating Your WordPress Site to Gutenberg? Wordpress

Why Shared Hosting Is So Cheap?

John AllenNovember 29, 2022
Thinking of Updating Your WordPress Site to Gutenberg? Wordpress

How To Start Blogging: 7 Steps To Starting A Blog

John AllenNovember 29, 2022
Thinking of Updating Your WordPress Site to Gutenberg? Wordpress

Benefits to Hosting Your E-Commerce Site on A Dedicated Server

John AllenNovember 25, 2022

© 2024 Thinking Wordpress. All Right Reserved

  • Tips n’ Tricks
  • Guides
  • Plugins
  • WordPress
  • Developing
  • SEO tips
  • Server
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT