Aligning Embedded Youtube Videos

  • Unknown's avatar

    I had gotten some support on aligning the caption under an embedded youtube video by using the css coding –

    .wp-caption-text, .wp-caption-dd, figcaption {
    text-align: center;
    }

    but now the video its self will not align center within the block. What other css do I need to add to make both the video and caption text align to the center of the block?

    Here is an example page that I have posted already.

    https://sakeinsgaming.wordpress.com/2023/05/19/preorder-mortal-kombat-1-here/

    Thanks in advance!

    WP.com: Yes
    Jetpack: No
    Correct account: Yes

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Hi there, in looking at the page you reference, I’m seeing the YouTube there is mostly centered, but it seems there is an issue with the iframe code from YouTube and then video display is slightly narrower than the actual content area available with your theme. You can give the following CSS a try which should force it to be centered.

    /* force youtube iframe centered rs */
    .embed-youtube iframe {
      margin-right: auto !important;
      margin-left: auto !important;
    }
  • Unknown's avatar

    That worked great! thanks so much :)

  • The topic ‘Aligning Embedded Youtube Videos’ is closed to new replies.