• I am trying to center embeds within posts and pages in WordPress. I can center my Twitter embeds but am having and issue trying to center other embed including other social media embeds within posts.

    Is the a global css coding that will just center all embeds, or do I have to add each type of embed individually?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Cathy Mitchell

    (@multitalentedmommy)

    I had a look and can’t see which isn’t centered. In general embeds are an issue. If they have specific width & height, you need a column of equal width that you can then center on page.

    You can try putting your embeds within a group that has a custom class specified. Then target the group with some custom CSS that centers the content in the group. I prefer flexbox, so it would look like this:

    .my-custom-group-class {
    display: flex;
    flex-direction: row;
    justify-content: center;
    }

    I tested this on the “Destiny 2: The Edge of Fate – What is Kepler?” YouTube embed on the page you linked and it works – looks like you already have the embed within a group as well, so you just need to add a class to the group and use the CSS above.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Centering Embed in WordPress Posts’ is closed to new replies.