• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

can't get video to center in responsive div

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › can't get video to center in responsive div

This topic is: not resolved

Tagged: responsive video container

  • This topic has 6 replies, 4 voices, and was last updated 10 years, 7 months ago by Wirebird.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • April 4, 2014 at 11:43 am #98488
    Doug
    Member

    Hello,

    Does anyone know how to center a video in a responsive div?

    I really appreciate the help; I can't figure this out.

    Thanks, Doug

    <div class="video-container"><iframe src="//www.youtube.com/embed/vnyBn3QgBrg" height="332" width="590" allowfullscreen="" frameborder="0"></iframe></div>
    
    .video-container {
        position: relative;
        padding-bottom: 56.25%;
        padding-top: 30px; height: 0; overflow: hidden;
        max-width: 590px;
    }
    .video-container iframe,
    .video-container object,
    .video-container embed {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
    http://usasharp.com/
    April 4, 2014 at 12:00 pm #98489
    Tony @ AlphaBlossom
    Member

    Hello,

    adding "margin: auto;" to your .video-container style (around line 1898 of your theme's styles.css file) will center it.

    Have a great weekend!

    Tony


    Tony Eppright | http://www.AlphaBlossom.com | Follow me on twitter @_alphablossom

    April 4, 2014 at 12:04 pm #98492
    AnitaC
    Keymaster

    Right, I only added this to my CSS and it works fine.

    .video-container {
        margin: 0 auto;
        width: 68%;
    

    }


    Need help with customization or troubleshooting? Reach out to me.

    April 4, 2014 at 12:33 pm #98496
    Doug
    Member

    Tony,

    Thank you, bless you; have a nice weekend yourself!

    Peace and gratitude,
    Doug 🙂

    April 4, 2014 at 12:34 pm #98497
    Doug
    Member

    Thanks, Anita.

    I appreciate it!

    Doug

    April 4, 2014 at 12:53 pm #98504
    Tony @ AlphaBlossom
    Member

    Hi Doug, you're very welcome!


    Tony Eppright | http://www.AlphaBlossom.com | Follow me on twitter @_alphablossom

    October 15, 2014 at 1:28 pm #127911
    Wirebird
    Member

    Thanks guys, this worked perfectly! Just needed to change absolute to relative for my theme.


    Sara @ Wirebird Media – WordPress and Genesis web developer based in Bend, Oregon

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble