We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

How to make images fit on homepage and product page?

How to make images fit on homepage and product page?

Mamdouh_USD
Excursionist
38 0 6

 

 

Hello all,

 

 

I want to make images of products fit the box on homepage and product page.

 

 

Store URL: https://u7yeji-na.myshopify.com

 

 

IMG_CB0D0B264D29-1.jpeg

 

Replies 6 (6)

ProtoMan44
Shopify Partner
772 60 115

@Mamdouh_USD hey, thanks for posting here.
 Please add this CSS in the custom CSS box in the customizer.

.card__media .media img {
    object-fit: contain;
    background: #fff;
}

ProtoMan44_0-1751368900103.png

 

 

- A thirsty developer passionate about supporting the community. If you'd like to, you can  

Buy me a Coffee.


- Your Shopify Solution Specialist Get a Quote at

ProtoMan44

 - 

Chat On Whatsapp


Crafting exceptional e-commerce experiences to elevate your online presence. Let's build your success story together!

AiTrillion
Shopify Partner
4265 250 754

Hi @Mamdouh_USD ,

To adjust the image, go to Online store >> Customize >> click on Featured collection or collection and change the image ratio to Adapt to image which will automatically display whole image according to width.

AiTrillion_0-1751369128079.png


If you stuck somewhere, feel free to message me or reply here. All the collections settings are same for both the home page and collection page.

Sachin D | Shopify Growth Expert @ AiTrillion

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- 10+ Years of eCommerce experience.
- 1400+ Stores Designed on Shopify.
- All in One Marketing App on Shopify AiTrillion Marketing Automation
.
- 13+ Shopify Apps launched on app store.
Mamdouh_USD
Excursionist
38 0 6

Hi @AiTrillion,

 

It worked perfectly on homepage but not on prdocut page. Can you help?

AiTrillion
Shopify Partner
4265 250 754

@Mamdouh_USD Basically, on the product page, the image doesn't get cropped. The image is perfectly appearing. Can you please share the screenshot?

AiTrillion_0-1751370450453.png

 

Sachin D | Shopify Growth Expert @ AiTrillion

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- 10+ Years of eCommerce experience.
- 1400+ Stores Designed on Shopify.
- All in One Marketing App on Shopify AiTrillion Marketing Automation
.
- 13+ Shopify Apps launched on app store.
Mamdouh_USD
Excursionist
38 0 6

 

On mobile view, the image gets cropped. You can check it.

AiTrillion
Shopify Partner
4265 250 754

@Mamdouh_USD Please add the below code at Online store >> Edit code >> add to theme.css or base.css  or go to Online store >> Customize >> Settings >> Custom CSS and paste the below CSS.

AiTrillion_0-1751372766058.png

 


@media screen and (max-width: 749px) {
.product__modal-opener {
    height: 100%;
}
}

Sachin D | Shopify Growth Expert @ AiTrillion

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- 10+ Years of eCommerce experience.
- 1400+ Stores Designed on Shopify.
- All in One Marketing App on Shopify AiTrillion Marketing Automation
.
- 13+ Shopify Apps launched on app store.