Centering Nested Blocks

  • Unknown's avatar

    I cannot find a a way to center a fixed width block (such as a column) inside a group block in Gutenberg. This seems so basic, but nothing seems to work. I use this CSS to center blocks in an html site:
    .outerBlock{
    background-image: hello.jpg
    }
    .fixedWidthBlock{
    max-width: 1200px;
    margin: auto;
    }

    I have tried everything, including centering blocks with th ealignment tool, but either I can’t set a width of 1200px to the block OR I can’t see center alignment.

    Please help.

    I don’t have a site with WordPress.com yet

  • Hi there!

    Just to check, was this for a site you’re hosting with us here on WordPress.com?

    Feel free to share the URL; please bear in mind that we are able to help with sites that are hosted here with us on WordPress.com, but for sites using the WordPress software from WordPress.org, there is a community forum at this address:
    https://wordpress.org/support/forums/

    That said, if you’re wanting to have a background image for your column then perhaps nesting the column inside a Cover block rather than a Group block would work better for that; the Cover block generally centers other ‘container’ blocks like columns by default:

    Cover Block

  • The topic ‘Centering Nested Blocks’ is closed to new replies.