Need help in reducing the right margin on product page.

Topic summary

A user encountered excessive right margin spacing on their Shopify product page that couldn’t be fixed through theme settings alone. Multiple community members provided CSS solutions targeting different potential causes:

Primary Solution (Confirmed Working):

  • Modify .product__info-container in section-main-product.css
  • Change max-width: 60rem to max-width: 100%
  • This allows the container to use full available width

Alternative Approaches Suggested:

  • Override padding/margin on .page-width and .product__info-wrapper classes
  • Adjust grid gap settings
  • Modify slider-component padding in base.css
  • Target image-with-text__content padding for specific sections

Resolution Status: The original poster confirmed the max-width solution worked successfully.

Follow-up Requests:
The user then asked two additional styling questions:

  1. How to reduce product title size
  2. How to remove background color behind the “Add to Cart” button

CSS code was provided targeting .product__title h1 font-size and .product-form__submit span background-color to address these new requests.

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

Need help in reducing the right margin on product page. Settings are fine. I think I need to change some code. Can you guys help. PFA. Thanks!

1 Like

Hey @TJ2022 ,

Welcome to the Shopify Community!

Thanks for the screenshot and the code! Based on the image and your CSS snippet, it looks like there’s unnecessary right spacing (probably due to padding or margin applied by the theme layout or container classes).

Here’s how we can debug and fix it:

Try This CSS Override:

  • Add the following to your theme’s custom CSS area (Online Store > Themes > Customize > Theme settings > Custom CSS) or inside your base.css or theme.css:
#shopify-section-template--17886088659122__main .page-width,
#shopify-section-template--17886088659122__main .product__info-wrapper {
    padding-right: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
}

If your theme uses a grid layout like grid–1-col, you might also need:

#shopify-section-template--17886088659122__main .grid {
    gap: 0 !important;
}

Mobile Consideration (Optional)

To ensure responsiveness, wrap overrides in media queries if needed:

@media (min-width: 768px) {
  #shopify-section-template--17886088659122__main .product__info-wrapper {
    max-width: 100%;
  }
}

Best Regards,

Rajat

Shopify Expert

Hello there TJ @TJ2022 Here are the steps you should take in solving this issue.

Step 1: Go to Online Store->Theme->Edit code.

Step 2: Search file base.css

Step 3: Paste the below code at bottom of the file → Save

slider-component.slider-mobile-gutter.page-width.page-width-desktop {

padding: 0 !important;

}

Let me know if this works for you!

Hi @TJ2022

Please open your section-main-product.css, find this code

.product__info-container {
    max-width: 60rem;
  }

Change 60rem in the code to 100% and save your file

1 Like

Hi @TJ2022 ,

Please go to Customize > Sections > Image with text > Custom CSS > Add code:

@media screen and (min-width: 750px) {
.image-with-text__content {
    padding-right: 0;
}
}

Hi @TJ2022 :waving_hand: ,

Absolutely! If your theme settings look fine but you’re still seeing a large right margin on the product page, the issue might be caused by a max-width restriction on the container element.

Here’s how you can fix it:

Step 1 :- Go to your Shopify Admin.

Step 2 :- Navigate to Online Store > Themes.

Step 3 :- Click “Edit code” on your active theme.

Step 4 :- In the Assets folder, open the file named section-main-product.css (or similar, depending on your theme).

Step 5 :- Search for this CSS class:

.product__info-container {
  max-width: 60rem;
}

If the max-width is set to a smaller value like 60rem, it could be limiting the content width and visually creating that extra margin. Try updating it to:

.product__info-container {
  max-width: 100%;
}

This change will allow the container to use the full available width, which should help eliminate the unwanted space on the right side.

Step 6 :- Save the changes and refresh your product page to see the update.

Let me know if you need further assistance!

1 Like

Thanks a lot, I tried it and it worked

can you also tell me how to reduce the size of the title of the product?

and can you also help in removing the background color behind add to cart.

Please use this code

.product__title h1 { font-size: 22px !important; }
.product-form__submit span { background-color: transparent !important; }