Would you please specify which element occurred the problem? Is it possible to share a screenshot of your problematic area?
This CSS fixes it:
.wp-caption .wp-caption-text {
text-align: center;
}
To add or override CSS: use the “Additional CSS” option in the customizer. https://codex.wordpress.org/CSS#Custom_CSS_in_WordPress
Learn to use the Chrome Developer Tools or Firefox Developer Tools to help you see and test changes to your CSS.
Hi there,
You can use this CSS code. If you use this CSS code then without the right sidebar your CSS won’t be conflicted with other caption CSS.
.sidebar-right .wp-caption-text {
text-align: center;
}
-Thanks
Hello Everyone,
I appreciate your help, but I’m afraid these suggestions don’t solve the problem.
Here’s an example of the problem – There are three images with captions on this post:
https://cassinssparrow.org/2019/11/11/a-melancholgy-end-to-jeffersons-life-long-quest/
With WP 5.3.0, those captions are left-justified. But with WP 5.2.4, they were centered under each image — and center-aligned is the way I want them.
They appear to be centered when I’m editing the post. But they display left-justified when the published post is viewed through any browser.
How do I get the image captions re-centered?
Many thanks,
John
This CSS
figcaption {
text-align: center;
}
To add or override CSS: use the “Additional CSS” option in the customizer. https://codex.wordpress.org/CSS#Custom_CSS_in_WordPress
Learn to use the Chrome Developer Tools or Firefox Developer Tools to help you see and test changes to your CSS.
Hi there,
Here is the css code.
.wp-block-image figcaption {
text-align: center;
}
That worked great!
Thanks Steve and toufiq for your help.
John
Previous solutions centers the text even if the image is aligned to the left. This centers the text only if image is centered.
.wp-block-image figure.aligncenter {
text-align: center;
}
If you haven’t changed your theme’s CSS properties then the default css property to change is:
.wp-block-image figcaption {
text-align: center;
}
If you want step-by-step instructions on how to do it then follow this Guide.
Thank you, denisehilton, your code solved it for me!
Hello guys, this works for captions on images, but it doesn’t work for captions on galleries.
figcaption {
text-align: center;
}
Does anyone know how to center a gallery caption?
Thanks.
Luis
I got it to work using Chrome DevTools per the comment above:
figcaption{
margin-left: auto !important;
margin-right: auto !important;
}
Thank you @denisehilton, the guide was a nice quick tutorial.
Nate