Shopify themes, liquid, logos, and UX
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
Solved! Go to the solution
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 %}
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 %}
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 %}
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
Can you send a screenshot of theme.liquid file?
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 %}
Glad I helped, so the problem that it wasn't placed above body tag, right?
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!
Here is the transparent header:
Only on home page transparent header:
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024