How to remove padding around product images on mobile

How to remove padding around product images on mobile

kdop10
Tourist
6 0 2

Hello, 

I want to completely remove the padding around my product images on mobile view. I tried this code from another post but it only removes the padding from the first image. I want to also remove padding from every product image. 

 

Code I used:

 

 

@media screen and (max-width: 749px) {
    .product .grid--peek.slider .grid__item:first-of-type {
        margin: 0;
    }
    .product .product__media-list .product__media-item {
        width: 100%;
    }
}

@media screen and (max-width: 749px) {
    .product .grid--peek.slider .grid__item:first-of-type {
        padding-top: 0;
    }
}

 

 

 

1st product image (looks good):

IMG_1208.PNG

 

From 2nd image and onwards (white space on left and top of image):

IMG_1209.PNG

 

Any help would be appreciated!

 

Replies 5 (5)

Made4uo-Ribe
Shopify Partner
10057 2391 3018

Hi @kdop10 

The code youve provide is calling only the first image. 

Would you mind sharing your store URL? Thanks!

If this fixed your issue, Likes and Accept as Solution are highly appreciated. Coffee tips fuel my dedication.
Get experienced Shopify developers at affordable rates—visit Made4Uo.com for a quick quote!
Need THEME UPDATES but have custom codes? No worries, for an affordable price.
Made4uo-Ribe
Shopify Partner
10057 2391 3018

Just clarification, you like to make the image shown fully right? Like this. 

Made4uoRibe_0-1725054141619.png

If it is check this one. 

From you Admin page, go to Online Store > Themes

Select the theme you want to edit

Under the Asset folder, open the section-main-product.css

Then place the code below at the very bottom of the file.

 

@media only screen and (max-width: 749px){
.product-media-container.constrain-height .media {
  padding-top: max(var(--constrained-height), var(--ratio-percent));
}
}

 

And Save. 

 

 

Please don't forget to Like and Mark Solution to the post that helped you. Thanks!

If this fixed your issue, Likes and Accept as Solution are highly appreciated. Coffee tips fuel my dedication.
Get experienced Shopify developers at affordable rates—visit Made4Uo.com for a quick quote!
Need THEME UPDATES but have custom codes? No worries, for an affordable price.
kdop10
Tourist
6 0 2

It didn't work. I tried deleting the code I originally used but that just resulted the 1st page having padding all around. 

kdop10
Tourist
6 0 2

For reference I'm using dawn 15.1.0