Header stays transparent when sticky

Topic summary

  • A merchant reports the site header becomes transparent when it turns sticky during scroll and wants a solid background color. They note it’s not controlled by theme settings and previously worked.

  • First suggestion: edit theme CSS (Online Store → Theme → Edit code; open base.css/theme.css/main.css) and add .section-header { top: 0 !important; }. The merchant reports this did not resolve the issue.

  • Follow-up suggestion: add CSS to apply a background once the page has scrolled past the header:
    body:has(.scrolled-past-header) sticky-header.header-wrapper { background-color: #e5d9d9 !important; }
    This targets the sticky header when the body contains the state class .scrolled-past-header. A screenshot was provided showing the intended result.

  • Attachments (screenshots) illustrate where to edit CSS and the visual outcome; they aren’t required to understand the fix.

  • Current status: The second code proposal appears promising, but there’s no confirmation from the merchant yet. The thread remains open pending feedback on whether the background color applies correctly during scrolling.

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

Hi, from some reason my header became trasparent for stick mode (while scrolling) as well. Can anyone help me set a color as background when scrolling ?

It is not from the settings.. not sure what happened. It was fine until now

https://cbh9cs8hom6nk645-75482267975.shopifypreview.com

Hi @Daniel19901 ,

You can try this code by following these steps:

Step 1: Go to Shopify Admin → Online Store ->Theme → Edit code

Step 2: Search file base.css, theme.css or main.css

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

.section-header {
    top: 0 !important;
}

Here is result:

Hope this can help you,

If our suggestions are useful, please let us know by giving it a like or marking it asa solution. Thank you :heart_eyes:

Hi, it didn’t work :(((

Hi @Daniel19901 , try again with this code :

body:has(.scrolled-past-header) sticky-header.header-wrapper {
   background-color: #e5d9d9 !important;
}

Here is result:

Hope this can help you,

If our suggestions are useful, please let us know by giving it a like or marking it asa solution. Thank you :heart_eyes: