hosting tutorials WeChat Top

👋🏼Welcome to my WP-Host blog where I am excited to share my knowledge and expertise on WordPress hosting and website construction tutorials with you. Let’s connect and learn from each other! You can reach me at

Email Me




微信:18200592859 或 yrwordpress

Automatically center images on a wordpress website


Automatically center images on a wordpress website: If there are some small pictures in your wordpress website, they don’t look so coordinated by default, so we can add a centering effect to the picture, but it is more troublesome to add this to each picture, so today’s wordpress tutorial will give Let’s share how to automatically center all the pictures in the wordpress website.


Keep sharing wordpress tutorials.
When we edit the content of the website, we generally choose to center the picture, which can make the overall layout look more beautiful. Some wordpress website building themes may have the function of centering pictures, but most of them do not.


So under normal circumstances we will manually set the picture drama.
Select the picture in the wordpress block editor, and then set it as shown above to center the picture.
If you have pictures in each article that need to be centered on the device, then this operation may be too troublesome. Next, I will share with you two methods.

Method 1: Increase the image size

Under normal circumstances, wordpress theme templates have a maximum image display size.
Assuming that the maximum display size of your WordPress theme is 800 PX, then you only need to give each article a picture greater than or equal to 800 PX, so that the picture will be spread horizontally, and the display effect is the same as that of centering.

Method 2: Set CSS style

Add the following CSS style to the style.css file of the current wordpress website building theme and save it, and then clear the cache, so that the pictures of future articles will be automatically displayed.

.entry-content img {
display: flex;
margin: 0 auto;








.entry-content img {
display: flex;
margin: 0 auto;
WordPress Hosting / 悦然wordpress建站

WordPress Hosting / 悦然wordpress建站

【WordPress Hosting / 悦然wordpress建站】I am a WordPress hobby from China, and I like to communicate with friends from all over the world to learn WordPress website building and maintenance related knowledge.