Error code

AI-generated summary

Need: limit custom Shopify CSS so it affects only specific sections, especially “Shop by Category,” instead of the entire store. The original issue is that the current CSS was added globally, so it changes headings, buttons, and product form elements site-wide and also causes layout/design problems in that section.

Main guidance given:

  • Global CSS files apply everywhere in the theme.
  • To scope styling, place the code inside the target section’s custom CSS area or directly in that section’s Liquid file.
  • A more precise fix is to wrap the target area in a dedicated class, then prefix all selectors with that class.

Concrete solution proposed:

  • Add a wrapper class such as .shop-category-section to the main div of the intended section.
  • Update all CSS selectors to start with .shop-category-section so styles apply only there.

Outcome: a practical scoped-CSS solution was provided, but the thread does not confirm whether it was implemented successfully. Attached screenshots appear to show the affected store section and design issue.

Hi everyone,

I’m currently using a custom script to improve the design and behavior of my Shopify store, but I only want it to apply in specific areas, not across the entire site.

In particular, I would like to use these improvements only in certain sections like “Shop by Category” to make them look more premium, while keeping the rest of the store unchanged. Right now, the code is affecting everything and also causing issues with the “Shop by Category” section.

If anyone can help me adjust the code so it only works in selected sections or categories, I would really appreciate it.

Thank you!

.sticky-mobile-cart { display: none !important; } product-form .quick-add_\_*submit, product-form .product-form*\_\_*submit, .card*\_\_*content .button, .card*\__content .btn { background-color: #0d0d0c !important; color: #f2f2f0 !important; border: n ![MAH 2|690x345](upload://oXwEe8ErQ5GtyoRoBXnxyKXC4V6.jpeg) ![MAH 3|690x135](upload://9P2zZqx2jjkuRPcA34upNyKmnym.png) one; } /\* TITOLI SHOPIFY \*/ h2 { text-align: center !important; text-transform: uppercase !important; letter-spacing: 2px !important; font-size: 20px !important; font-weight: 500 !important; margin: 40px 0 25px !important; position: relative; } h2::after { content: ""; display: block; width: 40px; height: 2px; background: #000; margin: 8px auto 0; opacity: 0.4; }

@PeppePro02 this is a css code, if you save it in css file of the theme, it will get applied for the entire site. If you want to add it for particular section then please add it in custom css section of that particular section.

Or you can add it to the liquid file of that particular section, this will need bit of coding knowledge to pin point exact file being used for section.

Hi,

To apply on section special you should use class attribute that belong to that section.

Or you also create a file individual and then import it to section that you want.

try using the below code. Add the class shop-category-section to the main div where you want to apply this css

.shop-category-section .sticky-mobile-cart {
display: none !important;
}

.shop-category-section product-form .quick-add__submit,
.shop-category-section product-form .product-form__submit,
.shop-category-section .card__content .button,
.shop-category-section .card__content .btn {
background-color: #0d0d0c !important;
color: #f2f2f0 !important;
border: none !important;
}

.shop-category-section h2 {
text-align: center !important;
text-transform: uppercase !important;
letter-spacing: 2px !important;
font-size: 20px !important;
font-weight: 500 !important;
margin: 40px 0 25px !important;
position: relative;
}

.shop-category-section h2::after {
content: "";
display: block;
width: 40px;
height: 2px;
background: #000;
margin: 8px auto 0;
opacity: 0.4;
}