How to Make Captions on All Images Centered By Default

A few days ago, Hugh at Hugh’s News and Views wrote a post How to Center Captions Under Images and Photos In a Blog Post. Many responded that they had struggled with the same issue, me included.

Hugh’s instructions, excellent as always, work on individual images. If your posts contain many images or photos, you might find it tedious to do each one separately.

What if you could center all of the image captions on your site as the default?

YOU CAN!

By adding a short piece of CSS code in the Administration section of your site, you can center image captions by default.

HERE’S HOW:

Go to the Appearance tab and hit Enter

Image showing Admin Appearance tab

A menu list comes up with the Additional CSS tab. Hit this option.

Image showing Additional CSS tab

This opens the CSS Editor and is where you will add the short code to “magically” center all image and photo captions on your blog site.

Image showing CSS code to center captions

ENTER THIS CSS CODE


.wp-block-image figcaption {

text-align: center;

}


PRESS SAVE CHANGES

Check your sites images. How did that work for you? Good, I hope! If not, verify that it is typed exactly as written above.

BONUS OPTION

Now that you mastered that bit of programming, perhaps you would like to also change the text size (font). Just one addition to the code will do that for you as well.

HERE’S HOW:

Add the code font-size: small; to the code you just created. If you prefer to set a specific size font, it would be written as font-size 18px; replacing the number (18) with the specific size you want.

Code to center and change font on captions

ENTER THIS CSS CODE


.wp-block-image figcaption {

text-align: center;

font-size: small;

}


PRESS SAVE CHANGES

I would love to hear from anyone/everyone on how this worked for you? Did you find it helpful? I’m open to questions on this as well.

Disclaimer: These bits of code may not work for all sites since not all blog sites are the created equal.

2 thoughts on “How to Make Captions on All Images Centered By Default

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s