Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Responsive Container

  • Hi, how I can set a responsive container with image background. When I set a fixed height, the image is cropped from the sides. I need height and width to be responsive. Now I have the height set to 100%.
    https://prnt.sc/09rCyJOZa2O4
    When I insert a block image it works fine. Unfortunately I need a container.
    Thanks for help.

  • Hi there,

    When I set a fixed height, the image is cropped from the sides.

    What was the fixed height value you set? Can you try 170px?
    Let me know 🙂

  • I had it set height 100%. When I set the height or min-height to 170px, my image gets cropped when I change the resolution.

  • Hi there,

    select the Container Block with the background image.
    In Advanced > Additional CSS classes add a custom class eg. fixed-aspect

    then add this CSS:

    .fixed-aspect {
        aspect-ratio: 16 / 9;
        width: 100%;
    }

    Adjust the aspect ratio to suit your needs.

  • Amazing. It works. Thank you David.

  • Glad to hear that!

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