Archived topic
Can you centre caption text for image blocks?
7 replies · Started by Joseph on June 2, 2020
Hello,
We're just getting ready to relaunch our site tomorrow but there's one thing I can't figure out: How to centre the caption text for images.
When I'm writing the page/post the caption appears centred under the image but as soon as I click preview or publish it becomes left aligned and the only text options I see for the caption text are Bold, Italics, or Link and the "More" dropdown menu only has Inline Code, Inline Image, Strikethrough and Text Colour. I can centre the images but not the caption.
I've linked to a specific page illustrating the left align captions...
Thanks,
Joseph
Hi there,
Try this CSS:
.wp-block-image figcaption {
text-align: center;
}
Adding CSS: https://docs.generatepress.com/article/adding-css/
Let me know if this helps :)
Hi Leo,
Thanks. Works perfectly. I simply added it as "additional css" since I want to keep plugins to a bare minimum and have no intention of switching themes. I like you folks. :)
No problem :)
I'm using this, and it works for captions under images and the individual images in a gallery.
.wp-block-image figcaption {
font-size: .8em;
margin-top: .25em;
margin-bottom: 1.25em;
text-align: center;
}
However, I cannot seem to center align the caption that appears under an entire gallery.
Any chance you can open a new topic and link us to the page in question?
Thanks :)
Will do...
Thanks!