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 (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Adsense Ad Hook Alignment

  • I would be more inclined to use Elements, simply for the ease of maintenance.

  • Thank you

  • You’re welcome

  • I created elements (Block hooks) for Google Ads. Some are aligned well, some not. For example, this one:

    I don’t know how to center it as an element because nothing I have tried works.

  • We do not have control over the ads, it comes with lots of CSS, and it might not be good CSS.

    Give this CSS a try, if it doesn’t work, you will need to check with the ads provider:

    .adsbygoogle {
        max-width: 100%;
        overflow-x: hidden;
  • Can I set this in the block settings (container) or add the code as a snippet?
    Also, the problem exists only on mobile

  • There is no place to add CSS code in block level, add it to customizer > additional CSS:

    @media(max-width: 768px) { 
    .adsbygoogle {
        max-width: 100%;
        overflow-x: hidden;
  • Hmm… no, it’s not working. Some ads are still aligned too far to the left. This is how it looks on the homepage. Is there no other solution?

  • The container block that the advert sits inside of, select that , and in the block settings set the alignment to Wide Width. This will allow the container to overcome the container padding. And then when the advert loads it should be able to fill the viewport width and be centred.

  • Are you talking about the first container or the parent container of HTML code?

  • The parent container thats wrapping the Advert HTML Code.

  • Can you take a screenshot of the container alignment?

  • May I ask you to go inside wp-admin and check it out? It would be more efficient. Private information updated

  • I made a modification to one of the mobile ads to simplify things.
    See here:

    The: Google Ad #2 (mobile) is now a plain Container block with no Layout, Spacing or Sizing.
    This will make the Container fill the width of the viewport.
    The only block setting is the Text Align Center. option.
    This will center and “block” HTML as well as text.
    The Inner Container block was removed.

    This will make the Container fill the width of the view port and centre the advert inside it.
    See if that works for you, if it does you can apply the same layout to the other mobile ad containers

  • I did it as you said. Removed inner container and center the parent container. These are screenshots of the Google ad for the sidebar on mobile.

Viewing 16 posts - 17 through 32 (of 33 total)
  • You must be logged in to reply to this topic.