How can I center an embedded YouTube video (without using the deprecated <center> tag)?

sort by: active | newest | oldest
BrettA179 months ago

Thanks for the tip. This came in handy for my personal self defense website, Armor and Shield Tech. http://www.armorandshieldtech.com

kenvonrauch4 years ago
The following thing worked for me:

I put this code in my style.css file:

.youtube {
margin-right: auto;
margin-left: auto;

And I added my youtube video to the actual post like this:

NachoMahma8 years ago
threecheersfornick (author)  NachoMahma8 years ago
. text-align won't work as it is not text
. <div class="youtube"> <video> </div>
.youtube {
margin-right: auto;
margin-left: auto

didn't work for unknown reasons
you need to add display:block; and a width to make that work
Add this before the first object tag:
<div style="text-align:center">
and this after:

Text align still centers it, even though it is not text.
iPodGuy8 years ago