I’m not sure why, but the “display” descriptor in your CSS is set to “table”. It should be “block”.
.wp-block-image .aligncenter, .wp-block-image .alignleft, .wp-block-image .alignright, .wp-block-image.is-resized {
display: block;
}
To add 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 to help you see and test changes to your CSS.
Thread Starter
Erin
(@etheeskimo)
Try
.wp-block-image .aligncenter, .wp-block-image .alignleft, .wp-block-image .alignright, .wp-block-image.is-resized {
display: block;
text-align:center;
}
Thread Starter
Erin
(@etheeskimo)
It worked! Thank you so much! I really appreciate your help, thank you again.
FYI, centering images if using Gutenberg is messed up right now. It creates this CSS for a DIV:
.wp-block-image .aligncenter, .wp-block-image .alignleft, .wp-block-image .alignright, .wp-block-image.is-resized {
display: table;
margin: 0;
}
This overrides the <figure>
img class:
.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
}
See: Alignment: images cannot be centered on front-end [3.7] · Issue #9503 · WordPress/gutenberg
Hello, sometimes these image centering problems can be solved with the !important tag after class. The keyword !important is used to give higher priority to an instruction, so that the following instructions cannot overwrite it. Sometimes you do well in a class, but you don’t overwrite an existing class.
My solution, therefore, is:
.wp-block-image .aligncenter, .wp-block-image .alignleft, .wp-block-image .alignright, .wp-block-image.is-resized {
display: block;
text-align:center!important;
}
[ Signature moderated ]
Curiously, the solution I provided the day before yesterday was used in our last project with Elementor [link redacted] . One of the programmers had problems with centering, and with modifying the .css file with the text-align:center!important instruction; everything worked perfectly 😀
Sorry about yesterday’s signature, I saw you moderated it, it won’t happen again. Greetings. Carlos Pérez.