Forums

[resolved] Center YouTube video (6 posts)

  1. vegan09.com
    Member
    Posted 1 year ago #

    I'm using Shortcodes Ultimate and I can't figure out how to center a YouTube video.

    [media url="http://www.youtube.com/watch?v=JJ--faib7to"]

  2. gn_themes
    Member
    Posted 1 year ago #

    Try to wrap this code in a DIV with next styles:

    <div style="width:600px;margin:0 auto">
    [media url="http://www.youtube.com/watch?v=JJ--faib7to"]
    </div>
  3. vegan09.com
    Member
    Posted 1 year ago #

    No the video still is not centered and this code is visible above the video: <div style=”width:600px;margin:0 auto”>,

    and this is visible below the video: ,</div>

    but thank you for trying.

  4. I'm not familiar with the [media] short code or that plugin but this does work in Twenty Eleven and the visual editor if you wrap it in [embed].

    [embed width="500" height="450"]http://www.youtube.com/watch?v=dQw4w9WgXcQ[/embed]

    I put in the width and height because Twenty Eleven was filling the video to the $content_width. That makes it difficult to demonstrate centering.

    Now highlight that line in the visual editor and center it.

    That will apply <p style="text-align: center;"> and the embedded video will be centered in the post.

  5. gn_themes
    Member
    Posted 1 year ago #

    You need to paste my code in HTML editor, not visual.

  6. vegan09.com
    Member
    Posted 1 year ago #

    That works Jan. Thanks both.

Topic Closed

This topic has been closed to new replies.

About this Topic