How can I vertically center product images in DAWN?

Solved

How can I vertically center product images in DAWN?

Revlon
Excursionist
29 2 2

Please, we want to cwnter product images verticaly in its container:

This doing it' job only while loading, on load picture is on top again:

 

.product:not(.product--no-media):not(.featured-product) .product__media-wrapper{
justify-content: center !important;
align-items: center !important;

 

 

Karum and other experts-we kindly ask for help:

 

https://cocoparfemi.com/products/burberry-burberry-edp-100ml-tester-lady

 

Accepted Solutions (3)

made4Uo
Shopify Partner
3874 718 1226

This is an accepted solution.

Hi @Revlon,

 

My understanding that you want to center the product image only. Therefore, please follow the instructions below

 

1. From your Admin Page, click Online Store > Themes >Actions > Edit code
2. In the Asset folder, open the base.css
3. Paste the code below at the very bottom of the file. Please choose between A, B, C code base on the outcome you want

 

A.

#Slide-template--15759526428821__main-27244995412117 > modal-opener > div > img {
    transform: translateY(30%);
}

This is the outcome:

made4Uo_0-1661823112894.png

 

 

B.

.product.product--small.product--stacked.grid.grid--1-col.grid--2-col-tablet {
    margin-top: 5rem;
}

This is the outcome:

made4Uo_3-1661823207913.png

C:

.product.product--small.product--stacked.grid.grid--1-col.grid--2-col-tablet {
    align-items: center;
}

#Slide-template--15759526428821__main-27244995412117 > modal-opener > div > img {
    transform: translateY(20%);
}

 

This is the outcome:

made4Uo_4-1661823431563.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

View solution in original post

KetanKumar
Shopify Partner
37618 3670 12162

This is an accepted solution.

@Revlon 

can you please try this code

1. Go to Online Store->Theme->Edit code
2. Asset->/section-main-product.css ->paste below code at the bottom of the file.

.product.grid {
    align-items: center !important;
    justify-content: center !important;
    margin-top: 30px !important;
}

 

If helpful then please Like and Accept Solution. Partnership of your ️ Coffee Tips and my code can bring miracles.
Want to modify or custom changes on store Hire Me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing

View solution in original post

Revlon
Excursionist
29 2 2

This is an accepted solution.

We solved thanks for help... But problem was afterward resizing 

Box size to be = content size

 

With this parameter instead is ok now:

 

.grid--peek.slider--mobile .grid__item {
height: 320px;
margin: 0;
}

 

 

View solution in original post

Replies 11 (11)

NerdCurator
Shopify Partner
440 80 112

@Revlon I can see only one image on the product link you have attached. Can you please explain what are you looking for ?

Believes in delivering optimizing web solutions | Shopify Partner | Working as a web developer for last 10+ years.
- Was my reply helpful? Click Like to let me know! Coffee tips fuel my dedication.
- Was your question answered? Mark it as an Accepted Solution
Email me: info@nerdcurator.com
Revlon
Excursionist
29 2 2

*center

*Karum

Tnx so much for interest NerdCurator...

We want to center it vertically in container... We suceed it with code above but only in loading time...

Onload it is on top again 😞

 

We want very same effect with every product image.

(

 

 

 

Images are limited by us on max-height:320px 

Container is defined at 320px..

But if height is lower we want to be centered...

Sorry for bad english.

 

 

Revlon
Excursionist
29 2 2

Kumar

made4Uo
Shopify Partner
3874 718 1226

This is an accepted solution.

Hi @Revlon,

 

My understanding that you want to center the product image only. Therefore, please follow the instructions below

 

1. From your Admin Page, click Online Store > Themes >Actions > Edit code
2. In the Asset folder, open the base.css
3. Paste the code below at the very bottom of the file. Please choose between A, B, C code base on the outcome you want

 

A.

#Slide-template--15759526428821__main-27244995412117 > modal-opener > div > img {
    transform: translateY(30%);
}

This is the outcome:

made4Uo_0-1661823112894.png

 

 

B.

.product.product--small.product--stacked.grid.grid--1-col.grid--2-col-tablet {
    margin-top: 5rem;
}

This is the outcome:

made4Uo_3-1661823207913.png

C:

.product.product--small.product--stacked.grid.grid--1-col.grid--2-col-tablet {
    align-items: center;
}

#Slide-template--15759526428821__main-27244995412117 > modal-opener > div > img {
    transform: translateY(20%);
}

 

This is the outcome:

made4Uo_4-1661823431563.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
Revlon
Excursionist
29 2 2

Made4Uo : please only this is need to this post be accepted solution: how to replace this : #Slide-template--15759526428821__main-27244995412117

 

to work for every product image, not just that one

Revlon
Excursionist
29 2 2

This is an accepted solution.

We solved thanks for help... But problem was afterward resizing 

Box size to be = content size

 

With this parameter instead is ok now:

 

.grid--peek.slider--mobile .grid__item {
height: 320px;
margin: 0;
}

 

 

KetanKumar
Shopify Partner
37618 3670 12162

This is an accepted solution.

@Revlon 

can you please try this code

1. Go to Online Store->Theme->Edit code
2. Asset->/section-main-product.css ->paste below code at the bottom of the file.

.product.grid {
    align-items: center !important;
    justify-content: center !important;
    margin-top: 30px !important;
}

 

If helpful then please Like and Accept Solution. Partnership of your ️ Coffee Tips and my code can bring miracles.
Want to modify or custom changes on store Hire Me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
Revlon
Excursionist
29 2 2

 

Thanks you all so much...

We are close to the solution..

 

It is little bit tricky... Height is limited by us to 320px(we wanted to be same as width on mobile, it is optimized for mobile, but we did not kbow how to define in relative for height to be same as full width) 

Nevermind, align-items should but dont resolve (because it somehow short image height and container probbably)

 

But we did not want to move just from top... (On mobile than it is over other elements, overflow etc...) We want to center...

Anyway this part of code help us combing with other image and container parameters:

#Slide-template--15759526428821__main-27244995412117 > modal-opener > div > img { transform: translateY(20%); }

 

 

But aranged like this:

#Slide-template--15759526428821__main-27244995412117 > modal-opener > div > img { transform: height: 320px; }

 

It resolve issue but just for that one product. Please to all: how to define this part:

 

 #Slide-template--15759526428821__main-27244995412117

 

 

To be as much it can be abstract(what is word for opposite of concrete? 🙂 

 

So it resolve issues for all products not just one(and perhaps not specific for only this shop if somebody in future find this thread)

 

Sorry for catastrofic english... 

Any sugestions about site(it looks terrible on desktop 😕 ) www.cocoparfemi.com are wellcomed.

 

Thank you all and they should ypu pay better for such strong support to sopify clients 🙂

 

 

 

#Slide-template--15759526428821__main-27244995412117 > modal-opener > div > img { transform: translateY(20%); }

Revlon
Excursionist
29 2 2

All of this is amateur work sorry for asking simple questions...

We need this part without numbers of product 🙂 (and if it is possible page itself):

 

#Slide-template--15759526428821__main-27244995412117

 

 

It will resolve.

Sorry for stupid question we tried with "(.slide-template) (__) (.main-product)" and such combinations but we failed to realize that correct one

Revlon
Excursionist
29 2 2

We tried to start with .modal-opener without prefix but it is not working 😞

 

 

Please: how to define that?

 

Thanks in advance to all experts!

Jahid-KlinKode
Excursionist
145 1 5

Hi @Revlon, discover a solution for centering product images vertically in the Shopify Dawn Theme by watching this YouTube video: https://www.youtube.com/watch?v=LNCzj6cxw1s.