Centering YouTube Videos

WordPress automatically displays YouTube videos when you put the shared link into a post. (Leave a blank line before and after the link.)

Sometimes you want to center the video and this code will do it.


<iframe style='margin: 0 auto; display:block' width='560' height='315' src='https://www.youtube.com/embed/xnBAwUV7abA' frameborder='0' allowfullscreen></iframe>
<p class='caption'>Bruiser and Bird</p>

Bruiser and Bird

If you use the centering trick, the video won’t display in preview mode.

You can have the video start at a specific location by appending the time to the link.


https://youtu.be/xnBAwUV7abA?t=43s

Leave a Reply

You must be logged in to post a comment.

Well Golly


Atheism Plus

Buy from Amazon