center product collection

Topic summary

Issue: The home page product collection grid is not centered. The requester shared screenshots and a site link for reference.

Proposed fixes (CSS-based, via Online Store > Themes > Edit code):

  • Add in base.css or theme.css: .grid { justify-content: center; }
  • Scope to collection pages: .collection .grid { justify-content: center; } (can be inserted before in theme.liquid inside a block).
  • Alternative spacing: .grid { justify-content: space-evenly; } to distribute items evenly.
  • Target specific grid instance: .grid:last-child { justify-content: center !important; } for finer control.
  • Optional visual change: body .card__inner.gradient { background: #f2f2f2 !important; } to adjust card background.

Notes: “justify-content” is a CSS Flexbox property that horizontally aligns items within a flex container. Several replies include step-by-step instructions and screenshots. Images are central to show the current vs. desired layout.

Current status: One responder reports the collection appears centered now and asked for clarification, but there’s no confirmation from the original poster. Resolution is unclear/possibly achieved, pending the requester’s feedback.

Summarized with AI on December 23. AI used: gpt-5.

Hello

I’ve been having trouble for a while now getting my collection centered here on my home page. I have tried a lot of code in base.css but none of it works. hope someone can help me solve this problem.

Website: www.TruthTrust.dk

code: PINK

here are some pics of what it looks like:

and here is a pic of how i want it to look:

1 Like

Hello! @JoyDion Please follow these steps to add this CSS code:

  1. Go to your Online Store
  2. Click on “Themes”
  3. Select “Edit code”
  4. Open your CSS file. If you have a custom CSS file, open that instead.
  5. If you can’t find your custom CSS file, open “base.css”
  6. Add the following code at the end of the file.
.grid {
    justify-content: center;
}
body .card__inner.gradient {
    background: #f2f2f2 !important;
}

If you need further assistance, please let me know. If you found my help useful, consider liking this message and marking it as the solution.
Thank you
k.K

Hello @AdamT06

You can add code by following these steps

  1. Go to Online Store → Theme → Edit code.

  2. Open your theme.liquid file

  3. Paste the below code before on theme.liquid

.collection .grid { justify-content: center; }

Was my reply helpful? Click Like to let me know!
Was your question answered? Mark it as an Accepted Solution.

Hello @AdamT06
Go to online store ---------> themes --------------> actions ------> edit code------->base.css
add this code at the end of the file.

.grid {
justify-content: space-evenly;
}

result

If this was helpful, hit the like button and accept the solution.
Thanks

Hi @AdamT06

It seems like the current collection page is working as you wanted.
Could you please clarify what you require exactly?

  • Here is the solution for you @AdamT06
  • Please follow these steps:

  • Then find the base.css or theme.css file.
  • Then add the following code at the end of the file and press ‘Save’ to save it.
.grid:last-child {
    justify-content: center !important;
}
  • Here is the result you will achieve:

  • Please press ‘Like’ and mark it as ‘Solution’ if you find it helpful. Thank you.