Dawn Theme Header Transparent -Not aligned?

Topic summary

A user implemented custom CSS to create a transparent header that becomes opaque on scroll but encountered an alignment issue preventing it from centering properly.

The Problem:

  • Custom header code made the element transparent and sticky
  • Header failed to align to center despite styling attempts
  • Code included positioning, z-index, and transition properties

The Solution:

  • Missing semicolon after max-width: 100% in the CSS caused the styling to break
  • Once the semicolon was added, the header centered correctly

Resolution: Issue resolved. The user confirmed the fix worked after adding the missing punctuation. An alternative solution involving modifications to the base.css file was also suggested but the simpler syntax fix proved sufficient.

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

Hi, I have been working on my homepage header. I implemented some code to make it transparent and display the background upon scrolling, as it sticks. I only have one problem, it doesn’t conform to the center. I am not sure what I’m doing wrong. I would like some insight. Thanks.

Here it is,

https://neverendingplan.myshopify.com/ : bimoch

Here is the code in the theme.liquid

.header { position: fixed; top: 40px; left: 0; width: 100%; max-width: 100% z-index: 999; transition: background-color 0.3s ease; } .header.transparent { background-color: transparent; } .header.black { background-color: black; top:0; }

{% endif %}

Hi @nep

This is Henry from PageFly - Landing Page Builder App

You can try this code by following these steps:

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

header.header.header–middle-center.header–mobile-center.page-width.black {

max-width: 100% !important;

}

Hope that my solution works for you.

Best regards,

Henry | PageFly

1 Like

Hi @nep

Please add “;” after “max-width: 100%” to make your code work properly.

1 Like

Can’t believe I missed that…

It works, thank you so much!

1 Like

Thank you Henry!

1 Like

Happy I can help!

1 Like

You are welcome @nep :blush: