How to center align auto WordPress embeds

I came across this problem the other day when using WordPress auto embed feature. When you add an embed URL, for example “http://youtu.be/M-aGPniFvS0 ..”   it will automatically be aligned to the left (this depends on the theme). This can look odd depending on your layout, there is a trick to make it centered in the post by doing the following in the text editor:

<div style="text-align: center;">  
... embed url ...  
</div>  

It’s important that the div and the embed URL are all on separate lines.

Beware: Also there is a major drawback in that if you update the post again it will auto format the markup and remove the line spaces and the auto embed will not work.

Advertisements

One thought on “How to center align auto WordPress embeds

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s