How to make your Shopify header Transparent

Most Shopify themes come with a solid header that sits above your hero banner — wasting screen space and killing the full-width impact of your hero image. A transparent header overlays the hero, letting your banner stretch edge-to-edge from the very top of the page.

In this tutorial, I’ll give you the exact code to make your Shopify header transparent — no app needed, no theme switch. Just one section file you paste into your theme. It works with Dawn and all free Shopify 2.0 themes, and you can toggle it on or off from the Customizer.

Watch the Video Tutorial

Prefer to follow along visually? Watch the full walkthrough:

What You’ll Get

This isn’t a hacky CSS snippet – it’s a complete Shopify section with its own Customizer settings panel:

One-Click Toggle
Turn transparent header on/off from the Customizer.
Custom Colors
Pick any color for nav text and icons over the hero.
Logo Inversion
Automatically whitens a dark logo when transparent.
Mobile Safe
Desktop only – mobile keeps the theme’s default header.
Sticky Compatible
Works with None, On Scroll Up, Always, Reduce Logo.
All Free Themes
Dawn, Refresh, Craft, Studio, Ride, and more.

Step 1: Create a New Section File

Open Your Theme Code

  1. From your Shopify admin, go to Online Store > Themes.
  2. Click the three dots on your current theme > “Edit code”.
  3. In the left sidebar, scroll to the Sections folder.
  4. Click “Add a new section”.
  5. Name it: transparent-header
  6. Delete any default code Shopify puts in the file.

Step 2: Copy & Paste the Code

Click the Copy Code button below, then paste it into your new transparent-header.liquid file and click Save.

transparent-header.liquid
{% comment %}
  ============================================================
  Transparent Header -- by EcomRanks
  https://www.youtube.com/@EcomRanks
  Fiverr: https://fvrr.co/3BsbtyA
  ============================================================
{% endcomment %}

{%- assign s = section.settings -%}

{%- if s.enable_transparent -%}

<style>
  @media screen and (min-width: 750px) {
    .section-header::after,
    .section-header::before,
    .section-header > *::after,
    .section-header > *::before,
    .section-header header::after,
    .section-header header::before,
    .section-header .header-wrapper::after,
    .section-header .header-wrapper::before {
      display: none !important;
      border: none !important;
      height: 0 !important;
    }
  }
</style>

<script>
  (function() {
    'use strict';
    var TEXT_COLOR = {{ s.text_color | json }};
    var INVERT_LOGO = {{ s.invert_logo | json }};

    function getHeaderSection() {
      return document.querySelector('.section-header');
    }

    function applyTransparent() {
      if (window.innerWidth < 750) return;
      var section = getHeaderSection();
      if (!section) return;

      var bgEls = [section];
      section.querySelectorAll(
        'sticky-header, .header-wrapper, header,'+
        ' .header, [class*="color-"], .gradient'
      ).forEach(function(el) { bgEls.push(el); });
      if (section.firstElementChild)
        bgEls.push(section.firstElementChild);

      bgEls.forEach(function(el) {
        el.style.setProperty('background',
          'transparent', 'important');
        el.style.setProperty('background-color',
          'transparent', 'important');
        el.style.setProperty('background-image',
          'none', 'important');
        el.style.setProperty('box-shadow',
          'none', 'important');
        el.style.setProperty('border',
          'none', 'important');
        el.style.setProperty('border-bottom',
          'none', 'important');
      });

      /* Text and icon colors */
      section.querySelectorAll(
        'a, button, summary, span, p, h1, h2'
      ).forEach(function(el) {
        el.style.setProperty('color',
          TEXT_COLOR, 'important');
      });

      section.querySelectorAll('svg')
        .forEach(function(el) {
        el.style.setProperty('color',
          TEXT_COLOR, 'important');
        el.style.setProperty('fill',
          TEXT_COLOR, 'important');
      });
      section.querySelectorAll('svg path')
        .forEach(function(el) {
        el.style.setProperty('stroke',
          TEXT_COLOR, 'important');
      });

      if (INVERT_LOGO) {
        section.querySelectorAll(
          '.header__heading img,'+
          ' .header__heading-logo-wrapper img'
        ).forEach(function(el) {
          el.style.setProperty('filter',
            'brightness(0) invert(1)', 'important');
        });
      }

      var h = section.offsetHeight;
      if (h > 0) {
        section.style.setProperty('margin-bottom',
          (-h) + 'px', 'important');
      }
      section.style.setProperty('z-index',
        '4', 'important');
      section.style.setProperty('position',
        'relative', 'important');

      var mainFirst = document.querySelector(
        '#MainContent > .shopify-section:first-child');
      if (mainFirst && h > 0) {
        mainFirst.style.setProperty('margin-top',
          (-h) + 'px', 'important');
      }
    }

    function clearTransparent() { /* mobile cleanup */ }
    function run() {
      if (window.innerWidth >= 750) applyTransparent();
      else clearTransparent();
    }

    if (document.readyState === 'loading')
      document.addEventListener('DOMContentLoaded', run);
    else run();
    window.addEventListener('load', function() {
      setTimeout(run, 100);
    });
    /* + MutationObserver for live customizer */
  })();
</script>

{%- endif -%}

{% schema %}
{
  "name": "Header Style",
  "settings": [
    { "type": "checkbox",
      "id": "enable_transparent",
      "label": "Enable Transparent Header",
      "default": true },
    { "type": "color",
      "id": "text_color",
      "label": "Text + Icon Color",
      "default": "#ffffff" },
    { "type": "checkbox",
      "id": "invert_logo",
      "label": "Invert logo to white",
      "default": true },
    { "type": "checkbox",
      "id": "show_credit",
      "label": "Show credit link",
      "default": true }
  ],
  "presets": [
    { "name": "Header Style" }
  ]
}
{% endschema %}
Important: The code block above is a preview – some functions are abbreviated for readability. Click Copy Code to get the complete, working file with all functions included.

Step 3: Add It in the Customizer

Open Customize

  1. Go to Online Store > Themes > Customize.
  2. Make sure you’re on the Home page.
  3. In the left sidebar under Header, click “Add section”.
  4. Search for “Header Style”.
  5. Drag it to the very top – above Announcement Bar and Header.
  6. Click Save.

Step 4: Configure Settings

Click the “Header Style” section to see these options:

Enable Transparent Header Toggle on to make it transparent. Off restores theme default.
Text + Icon Color Set to #FFFFFF (white) for dark heroes, dark color for light heroes.
Invert Logo to White Turn on if your logo is dark – it will appear white over the hero.
Show Credit Small “Header by Ecom Ranks” link. I’d appreciate if you keep it on!

Need Something More Advanced?

This free code handles a basic transparent header. If you need scroll-triggered solid backgrounds, separate scrolled logo, mega menu styling, or full theme customization – I build production-ready Shopify stores.

Hire Me on Fiverr Free Website Audit

Don’t Have a Shopify Store Yet?

Start your Shopify store for just $1/month – 3-day free trial + $1/month for 3 months (90 days total).

Start Your Shopify Store

Frequently Asked Questions

Does this work with all Shopify themes?

This code works with Dawn and all free Shopify 2.0 themes – Refresh, Craft, Ride, Studio, Colorblock, etc. For premium themes, minor adjustments may be needed. Hire me and I’ll customize it for your specific theme.

Will this break my sticky header?

No. The code uses a negative-margin technique that keeps the header in document flow. All four sticky options work: None, On Scroll Up, Always, and Reduce Logo Size.

How do I change header text to white when transparent?

Click the “Header Style” section in the Customizer and set Text + Icon Color to #FFFFFF. Toggle “Invert logo to white” to also whiten your logo.

What about mobile?

The transparent header only activates on screens wider than 750px. On mobile, your theme’s default solid header shows normally – better for small-screen usability.

How do I remove it?

Uncheck “Enable Transparent Header” in the Customizer to turn it off. Or click the three dots on the section and select “Remove section” to delete it entirely.

Can I make it transparent on all pages?

This version targets the homepage. Extending it to other pages requires additional Liquid logic. Hire me on Fiverr and I’ll build a version with per-page controls, solid-on-scroll, and more.

I need more advanced features – can you help?

Yes! I can build: solid background on scroll, separate scrolled logo, per-page controls, mobile transparent header, mega menu styling, and full store builds. WhatsApp me or hire me on Fiverr.

Let’s Build Your Dream Shopify Store

I’m a Shopify developer specializing in theme customization, CRO, and custom sections. Small tweak or full store build – I’m here to help.

Hire on Fiverr Hire on Upwork WhatsApp
Subscribe on YouTube ecomranks.net [email protected]

Built by EcomRanks – Shopify Development & CRO

Leave a Comment

Your email address will not be published. Required fields are marked *