Dawn 12.0: How to Make Header Transparent on ONLY Home Page

Solved

Dawn 12.0: How to Make Header Transparent on ONLY Home Page

nadiamejilla
Shopify Partner
28 1 1

Hello! I'm working a website and I want the banner image on the home page to bleed into the header. I was able to do this with the following CSS code, but now the header is transparent on ALL pages.

 

.header-wrapper.color-background-1.gradient {
  position: absolute;
  width: 100%;
  background: transparent;
  color: #000;
}
.header-wrapper * {
  color: #000;
}

I only want the header to be transparent on the home/landing page. What CSS should I add?

 

Here's the preview URL https://rt5as761kwdd4lm7-59803566217.shopifypreview.com

Accepted Solutions (2)

Abdosamer
Shopify Partner
895 163 183

This is an accepted solution.

Hi @nadiamejilla , First you need to remove 

 background: transparent;

 from your style , we will only added on the home page, go to theme.liquid file and add the following code in the bottom of the file above </body> tag,

{% if template == 'index' %}
<style>
.header-wrapper.color-background-1.gradient  {
     background: transparent;
}
</style>
{% endif %}

 

View solution in original post

nadiamejilla
Shopify Partner
28 1 1

This is an accepted solution.

Nevermind I was able to fix it - thank you for your help!! I pasted the following code at the bottom of the theme.liquid file (above <body> tag) to make it work. 

 

{% if template == 'index' %}
<style>
.header-wrapper.color-background-1.gradient {
  position: absolute;
  width: 100%;
  background: transparent;
  color: #000;
}
</style>
{% endif %}

 

View solution in original post

Replies 8 (8)

Abdosamer
Shopify Partner
895 163 183

This is an accepted solution.

Hi @nadiamejilla , First you need to remove 

 background: transparent;

 from your style , we will only added on the home page, go to theme.liquid file and add the following code in the bottom of the file above </body> tag,

{% if template == 'index' %}
<style>
.header-wrapper.color-background-1.gradient  {
     background: transparent;
}
</style>
{% endif %}

 

nadiamejilla
Shopify Partner
28 1 1

Hello! I deleted the code that I previously had and pasted your code in the theme.liquid file, but it didn't change anything.

 

I liked how the previous code appeared, but I only want it applied to the home page. Please help! Thank you

Abdosamer
Shopify Partner
895 163 183

Can you send  a screenshot of theme.liquid file?

nadiamejilla
Shopify Partner
28 1 1

This is an accepted solution.

Nevermind I was able to fix it - thank you for your help!! I pasted the following code at the bottom of the theme.liquid file (above <body> tag) to make it work. 

 

{% if template == 'index' %}
<style>
.header-wrapper.color-background-1.gradient {
  position: absolute;
  width: 100%;
  background: transparent;
  color: #000;
}
</style>
{% endif %}

 

Abdosamer
Shopify Partner
895 163 183

Glad I helped, so the problem that it wasn't placed above body tag, right?

nadiamejilla
Shopify Partner
28 1 1

Yes you're right - I had initially made a mistake and placed it below the <body> tag which is why it wasn't working initially. 

 

Anyways, thanks for your solution!

MRamzan
Shopify Partner
275 3 34

Here is the transparent header:

 

Hire Me:

WhatsApp: +91-9145985880
Email: [email protected]
Skype: mohdramzaan112

MRamzan
Shopify Partner
275 3 34

Only on home page transparent header:

Hire Me:

WhatsApp: +91-9145985880
Email: [email protected]
Skype: mohdramzaan112