Re: Center-align images in blog posts

How can I center-align images in my blog posts?

Kitblaketrouser
Tourist
4 0 3

Hi there

 

We have issues with centre-aligning images on our blog posts.

Despite centre-aligning them on the backend directly on each blog post, they often have issues and aligned to the left.

I have added this bit of code to theme.css.liquid, but it didn't change anything.

.article__grid-image-container,
figure.image {
text-align: center;

Our store is Kitblake.com

Thanks for your help.

Replies 6 (6)

made4Uo
Shopify Partner
3851 717 1195

Hi @Kitblaketrouser,

 

I am assuming that you are using the feature that Shopify has in aligning images. See image below

 

made4Uo_2-1682614204800.png

 

 

To use the feature. 

1. From you Admin page, go to Online store > Blog post
2. Go to the blog you want to edit.
3. Inside the content, click the image you want to align. This should highlight the image in blue

4. Click the "Edit image icon", see image below

made4Uo_1-1682614171371.png

 

 

 

 

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free
Kitblaketrouser
Tourist
4 0 3

Thanks very much, I have done this for all images but it still doesn't work, they're aligned on the left.

adsrole
Shopify Partner
53 1 5

Hello @Kitblaketrouser 

 

Here is the code for you.

 

.article__grid-image-container,
figure.image {
position:relative;
left: 50%;
transform:translateX(-50%);
}

 

Also, I am including the image of how it will look once implemented.

​Austin | Shopify Partner at AdsRole
[email protected] | +1 (855) 855-0990
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Kitblaketrouser
Tourist
4 0 3

Thanks @adsrole can you please confirm in what part of the theme code should I add this code?

Thanks!

adsrole
Shopify Partner
53 1 5

Hello @Kitblaketrouser 

 

<img style= "position:relative; left: 50%; transform:translateX(-50%);"

 

You can use it like this or share the class name to help you further.

​Austin | Shopify Partner at AdsRole
[email protected] | +1 (855) 855-0990
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Kitblaketrouser
Tourist
4 0 3

Thanks Austin, but it doesn't seem to work, weirdly.