weird placement of some products on the website

Topic summary

A user reported misaligned product displays on their collection page, where some items appeared taller than others, creating an inconsistent grid layout. Screenshots revealed the issue stemmed from mixing square and portrait-oriented product images.

Root Cause:
Product cards maintain uniform width but vary in height based on image aspect ratios, causing portrait images to display taller than square ones.

Solution Provided:
Two CSS-based fixes were offered:

  • Adding custom CSS code to the theme.liquid file (above the </body> tag)
  • Using CSS rules to force uniform aspect ratios and contain image fitting:
.card__inner.ratio {
  --ratio-precent: 100 !important;
}
.card__inner img {
  object-fit: contain !important;
}

Outcome:
The original poster confirmed the solution worked successfully. The discussion is resolved.

Summarized with AI on October 30. AI used: claude-sonnet-4-5-20250929.

Hello, could anyone explain why some of my products have incorrect placement on the website? is there a code for that to fix it? it doesn’t look good

thanks in advance

1 Like

Hey @Monness

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 tag


RESULT:

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

Best Regards,
Moeed

1 Like

Hi there. Some of your product images are square and some are portrait.

All product card images have the same width, so portrait ones will be show taller.

You may check this post – it is about the same issue: https://community.shopify.com/c/shopify-design/images-in-dawn-theme-are-not-the-same-size-or-too-large/m-p/2985676#M781637

But your theme has different name, so may have some differences…

If your theme does not have similar selector, you can another rule to the code suggested there, so it looks like this:

.card__inner.ratio {
  --ratio-precent: 100 !important;
  background: transparent;
}

.card__inner img {
  object-fit: contain !important;
}
1 Like

Hi, thank you for your reply. It worked like a charm! Thank you so much

1 Like

Thank you for your reply. I’m glad to hear that the solution worked well for you. If you require any more help, please don’t hesitate to reach out. If you find this information useful, a Like would be greatly appreciated.