How can I make the photos on my home page square without cropping them?

Solved

How can I make the photos on my home page square without cropping them?

Lexi123
Tourist
7 0 2

Hello,

I saw previous posts with the following code which worked perfectly for my product page:

 

#ProductGridContainer .card__media .media img { object-fit: contain !important; }

 

I need it to also work for the "trending collection" section on my home page. Unfortunately I couldn't find another code that could fix the issue. 

 

Could someone please help?

Accepted Solution (1)

BSSCommerce-HDL
Shopify Partner
2305 835 910

This is an accepted solution.

Hi @Lexi123

You can try this code by following these steps:

Step 1: Go to Shopify Admin -> Online Store ->Theme -> Edit code
Step 2: Search file base.css, theme.css, styles.css or theme.scss.liquid

Step 3: Insert the below code at the bottom of the file -> Save 

.home-page-tab.collection .card__media .media img {
  object-fit: contain !important;
}

Here is result: 

BSSTechVenture_0-1717052852614.png

Hope this can help you,

If our suggestions are useful, please let us know by giving it a like or marking it as a solution. Thank you 😍

Sale banner, pop ups: Customize your sale banner, pop-ups and create countdown bar to boost conversion rate.
Simicart: Transform your Shopify store into a stunning and fully functional mobile app with just a few simple steps.
Product Labels & Badges:
Get more sales with striking labels, badges, and banners from our 10,000+ available templates.

BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now

View solution in original post

Replies 4 (4)

Moeed
Shopify Partner
7687 2067 2548

Hey @Lexi123 

 

Follow these Steps:

1) Go to Online Store
2) Edit Code
3) Find theme.liquid file
4) Add the following code in the bottom of the file above </body> tag.

<style>
.card .media img {
    object-fit: fill !important;
}
</style>

RESULT:

Moeed_0-1717052842303.png

 

If I managed to help you then, don't forget to Like it and Mark it as Solution!

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications


Lexi123
Tourist
7 0 2

That was the wrong section but thank you for your input 😊

BSSCommerce-HDL
Shopify Partner
2305 835 910

This is an accepted solution.

Hi @Lexi123

You can try this code by following these steps:

Step 1: Go to Shopify Admin -> Online Store ->Theme -> Edit code
Step 2: Search file base.css, theme.css, styles.css or theme.scss.liquid

Step 3: Insert the below code at the bottom of the file -> Save 

.home-page-tab.collection .card__media .media img {
  object-fit: contain !important;
}

Here is result: 

BSSTechVenture_0-1717052852614.png

Hope this can help you,

If our suggestions are useful, please let us know by giving it a like or marking it as a solution. Thank you 😍

Sale banner, pop ups: Customize your sale banner, pop-ups and create countdown bar to boost conversion rate.
Simicart: Transform your Shopify store into a stunning and fully functional mobile app with just a few simple steps.
Product Labels & Badges:
Get more sales with striking labels, badges, and banners from our 10,000+ available templates.

BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now

Lexi123
Tourist
7 0 2

Thank you❤️