Changing Background Color for a Section

Topic summary

A user encountered an issue where CSS code only partially changed a section’s background color on their Shopify site, despite working correctly on other pages.

Problem:

  • Applied CSS targeting a specific section ID (#shopify-section-template...) with background: #121212
  • Background color only covered part of the section (screenshot provided)
  • Same approach worked successfully elsewhere on the site

Solution:
Another user provided a fix by suggesting different CSS targeting:

  • Navigate to: Admin → Online Store → Themes → Asset folder → main.css (or base.css/style.css/theme.css)
  • Add the following code at the bottom:
main#mainContent {
    background: #121212;
}

Outcome:
The solution worked perfectly. The original poster confirmed they had tried multiple combinations but missed this specific selector approach.

Summarized with AI on November 6. AI used: claude-sonnet-4-5-20250929.

Hello!

I am working on my site, and have been working on using code to change the background colors of sections. I was able to change the color of a section, but for some reason it is not doing the entire section (see attached picture). I was able to get this to work on some other pages but for some reason it won’t work for this one

The code I am using is:

section#shopify-section-template–15889756487746__1726069680f273bea4 {
background: #121212;
}

Site Address: https://a6aaf7-b7.myshopify.com/

Password: MSRed

1 Like

Hi @davidignite

Check this one.

From you Admin page, go to Online Store > Themes

Select the theme you want to edit

Under the Asset folder, open the main.css(base.css, style.css or theme.css)

Then place the code below at the very bottom of the file.

main#MainContent {
    background: #121212;
}

And Save.

Result:

Please don’t forget to Like and Mark Solution to the post that helped you. Thanks!

1 Like

Just slapped my forehead so hard… I tried every combination except for this one… You are a wizard, that worked perfectly, thank you so much!