Site logo

Archived topic

Default Centering for Image Blocks

11 replies · Started by Bruce on February 19, 2021

Viewing posts 1–12 of 12

For every image we add (which is hundreds in a typical week) we need to manually adjust the alignment to 'centered'. Is there a way to have the default for an image block set to centered?

FYI - we're an older site that switched over to Generate Press last month. Very pleased and happy to see the Theme easily handle our 3+ million monthly pageviews.

Hi there,

thats impressive stats - glad to hear your enjoying the theme!

Any chance i can see an example post/page where there are images - just need to check the markup before offering some options.

Hi Bruce,

You could try add this CSS, this should work for all single post pages.

.single .wp-block-image figure {
    margin-left: auto;
    margin-right: auto;
}

Let me know how it goes :)

Sorry Ying - that didn't seem to help. Added images at 575px remained left-justified.

Hi Bruce,

I just checked the page and all images are centered?

Ying's CSS should work.

Leo - our issue isn't how the posts look, it's the default image handling of wordpress that we would like to change. We have to manually center hundreds of images every week. I'm just looking for less work for my writers and editors by finding a way to change the default image block to being centered.
Not a big deal - the process only adds a few seconds - but we look to optimize were we can. thanks

I understand. And Ying's CSS should do exactly that.

If it isn't working for you, I'll need to see a page live with the issue on it to determine why it's not working.

Hi Chelsea,

It's much easier with a live site, so here you go:

.single .wp-block-image > *, .single .wp-block-image .wp-block-image {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
    float: none !important;
}

The CSS applies to all the single posts.

That did it! Thanks, Ying!

No problem :)

This archived topic is closed to new replies.