Support » Theme: GeneratePress » Images Not Staying In The Center

  • Resolved mus2018



    I updated to the version 5.0.2 wordpress. I’m just getting to know the ‘block system’.

    I added some affiliate link images to one of my posts, and a few small images. Even though I have set these to ‘align center’ (and they do center in the editor!), they are aligned to the left in my published post and preview.

    I have set the first two images to ‘wide width’ but they’re too big for my liking and the quality is poor. I’d rather have the smaller set size in Amazon, but centered in the middle.

    The last 2 product entires show the problem. The problem also exists with my ‘review’ images under each section.

    Does anyone know if there’s any code I can put in the ‘advanced’ section to make them actually centred? Or if there’s any other way to fix the problem?

    Thank you so much!

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 31 total)
  • Theme Author Tom


    Hi there,

    Looks like Elementor is preventing them from centering:

    .elementor .elementor-widget:not(.elementor-widget-text-editor) figure {
        margin: 0;

    Try adding this CSS:

    .elementor .elementor-widget:not(.elementor-widget-text-editor) .wp-block-image figure {
        margin-left: auto;
        margin-right: auto;

    Let me know 🙂

    Thread Starter mus2018


    It worked! Wow thanks so much Tom 🙂

    Theme Author Tom


    You’re very welcome 🙂

    Registered to say thanks Tom @edge22 you bloody legend. This issue was driving me insane.

    for what its its worth im using elementor with pro addon, and astra theme, all up to date.
    Strange problem, but the CSS does the trick.
    I add the CSS in the page template if that helps anyone else.

    Theme Author Tom


    Glad it helped 🙂

    Tom, thanks for that CSS.

    I had been racking my brain trying to add a way to center images in the elementor theme builder.

    I kept trying to center the element but nothing worked. This code worked. I assume it selected all of the proper parent containers to get the whole image block.

    Hi guys can you help me?
    I am also using the same config as @acehobojoe but i added the code in the additional css option in post template did not work then again removed and added in additional css option in the Appearance>customize option but still no luck.
    Anything more I can try?

    Also it seems to only happen when I add a caption the images,otherwise with the css code added the images do come in center


    Hey man, what theme are you using, and are you using elementor?

    One other work around is to use elementor page builder on the post itself.

    I am using wp astra and elementor
    Yeah I have a post template and I tried the css code inside it also but could not get it to work 🙁

    This worked great for the image, @edge22, but the caption is not centering.

    I hoped it was as easy as replacing “figure” with “figcaption,” but that’s not working.




    Can you link us to the page in question?

    Thanks 🙂


    I updated to WordPress 5.3 a few days ago. My inserted graphic images do not line up center. They show that they are lined up in the block editor, but when I view on my site they are left aligned.

    The page that I need help with is:

    Hi there,

    your site is not using the GeneratePress theme it is using TwentyTen – you would need to request support from that author. But for what its worth the image element looks centred to me.

    • This reply was modified 3 years, 1 month ago by David.

    The css provided by @edge22 works flawlessly but if I want to make the image align left or right, it looks like this:

    How to avoid that sort of margin on left/right side? Thanks in advance 🙂

Viewing 15 replies - 1 through 15 (of 31 total)
  • The topic ‘Images Not Staying In The Center’ is closed to new replies.