How to center grid block in a full width container

  • Hi,
    I’m trying to center a grid block with content and image in a container that goes full width. (See linked screenshot).

    https://i.postimg.cc/7hw4nbLG/image.png

    Thank you

  • Hello.

    It would be nice to see a URL but I will give it a go. You should have a container that wraps the grid or container that you have set the background color to. Try setting the background color to the outer container. If that doesn’t work, you need to set the page to full-width from the Layout setting on the right.

    Page layout settings

  • Hi George,
    That worked for having the background full width, but the grid block, with the content and image also stretch with it. (https://i.postimg.cc/yYsgW0w2/image.png)

    How do I have it where the grid box stays centered and at around a 950px width, and not stretched to the edge of the background? (https://i.postimg.cc/7hw4nbLG/image.png)

    Thank you,
    Lee

  • Hi Lee,

    First of all please remove:

    align-items: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    justify-items: center;
    justify-self: center;
    margin-left: auto;
    margin-right: auto;
    text-align: left;

    from the outer gb-element-8f72691a container.

    Then, on the grid container add max-width: var(--gb-container-width)

    Constraint max-width

  • I didn’t work. Everything just stretched edge to edge

    https://i.postimg.cc/5NjtzrXz/image.png

    Id like the stretch only the gray background edge to edge and keep the content block and image centered in the middle of the container.

    Thank you again

  • Hi there,

    Select the Grid block (.gb-element-37cd952b) and set both the left and right margins to auto.

  • Thank you Alvind,
    That worked!

  • You’re welcome!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.