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.

Image Resizing

  • Hi there!

    Previously, someone helped me with custom CSS code that would resize images to be wider than the container of my post body. Here is the code he provided me:

    .single-post figure.gb-block-image
    {
    margin-left: calc(-100vw / 2 + 100% / 2);
    margin-right: calc(-100vw / 2 + 100% / 2);
    max-width: 100vw;
    width: auto;
    text-align: center;
    }

    @media (min-width: 1400px) {
    .single-post figure.gb-block-image img {
    max-width: 1400px;
    }
    }

    I was wondering, is there a way I can update the code so that if I add a GenerateBlocks image block with an additional CSS class such as “no-resize” that it would not resize the image?

    I tried this, but it broke all the other images on the post.

    .single-post figure.gb-block-image img:not(.no-resize)
    {
    margin-left: calc(-100vw / 2 + 100% / 2);
    margin-right: calc(-100vw / 2 + 100% / 2);
    max-width: 100vw;
    width: auto;
    text-align: center;
    }

    @media (min-width: 1400px) {
    .single-post figure.gb-block-image img:not(.no-resize) {
    max-width: 1400px;
    }
    }

    Thanks in advance!

  • Hi there,

    not easily, as the class gets added to the img and you would need it on the figure

    To do that would mean having to add another container around the image block.
    Question which will be more common ? The wide images or the no-resize image ?

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