How can I centre Product Grid and make it full width?

Topic summary

Goal: center a Shopify product grid with a border and ideally make it edge-to-edge (full width).

What was shared:

  • A preview link and password were provided for inspection. Screenshots illustrate the current and desired look.
  • One reply gave steps to add code in theme.liquid (main layout file), but the actual code block appeared empty; a result screenshot was shown.

Proposed solutions (implemented via Edit code > theme.liquid, before ):

  • Center the grid using CSS:
    • .collection .grid { justify-content: center; }
  • For 4-column desktop grids, constrain each item to ~26% width to align and center:
    • .collection .grid–4-col-desktop .grid__item { width/max-width: calc(26% - var(–grid-desktop-horizontal-spacing)*3/4) !important; }

Open questions / latest update:

  • The author asked how to keep mobile as a 2-column grid instead of 4. No answer yet.

Status:

  • Centering guidance provided and partially addressed. The “bleed to edge” (true full-width) was not directly solved in the shared CSS. Mobile 2-column behavior remains unresolved.
Summarized with AI on December 22. AI used: gpt-5.

I have added a product grid with a border but it isn’t centered.

Ideally, i would like the grid to bleed out to the edge?

Is this possible?

Thanks!!

@visualess Hey, thanks for posting here.
can you please share the link to inspect it, thanks.

Hey @visualess

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

password: 44444

Hello @visualess

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; } .collection .grid--4-col-desktop .grid__item{ width: calc(26% - var(--grid-desktop-horizontal-spacing)* 3 / 4) !important; max-width: calc(26% - var(--grid-desktop-horizontal-spacing)* 3 / 4) !important; }

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

@visualess put this in css code :

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

Is there a way to make it so that the mobile version still stacks as a 2 product grid instead of 4?

Is there a way to make it so that the mobile version still stacks as a 2 product grid instead of 4?