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 Block Anchor CSS

  • Hi

    I am having a hard time adjusting to Blocks 2.0.

    Today I’ve spent like 2 hours trying to figure out how to target the anchor wrapper of the Image block IMG. I can’t center the image with the link because the A spans 100% of the container.

    If I select Image block and go to Manage selectors > Links, the style creates a selector: .image-class a. This does not select the wrapper A (the HTML markup is ).

    Markup:

    <a href="/"><img class="gb-media-db542c51" --></a>

    Added style:

    .gb-media-db542c51 a {
        display: block;
        width: 900px
    }

    Should be:

    <a href="/" class="CUSTOM-CLASS-HERE"><img class="gb-media-db542c51" --></a>

    How to style the wrapper anchor element with style editor?

  • Hi there,

    You can wrap the Image block inside a Container. Then, select the Container and use the Style selector to target Links, this will apply styles to the anchor tag of the the image.

  • This solution works, but it is not ideal that you do not have any control over the A-wrapper within Image block.

  • I’m not sure I understand what you mean by “the wrapper within the Image block.” The anchor element is outside, wrapping the Image block, so the solution I suggested by targeting the <a> tag from the wrapper container should work.

  • Hi there,

    thanks for raising the issue, as you have pointed out, the link style selector doesn’t work for the image block and actually it should be removed as its redundant. I’ll get an issue raised to correct that.

    To center the Image Block without the additional wrapper try:

    1. select the image block
    2. set the Layout > Display to Block
    3. set the Layout > Spacing > Margin to auto

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