How can I correctly center an image using custom HTML?

Hi I’ve used the following code.

But still doesn’t seems to be working. Any suggestions please. Thank You.

2 Likes

I had this same problem and I fixed it with inline CSS that sets the display type to a block inside the element. The “text-align: center” solution that is commonly suggested doesn’t apply to images because… well, it’s for text alignment rather than images.

<img style="display: block; margin-left: auto; margin-right: auto; width: 50%" src=(whatever your actual source is)>

You can change how large the image is with the “width” property.

11 Likes

Yes! It works: img center + desired size. Thanks!

1 Like

God thanks, it worked for me !

1 Like

THANK YOU for this!

Worked great, thank you!

Thank you so much!!!

A onde posso mudar isso não estou conseguindo!

1 Like

Olá. Você conseguiu resolver?

Eu não sei como fazer, onde que devo fazer, poderia ensinar?

1 Like

Hey sorry for asking this 4 years later but where should I put it? I put it in a custom CSS inside a image with text as well as a custom liquid block but it still doesn’t work somehow