Re: Background image in Default home page Dawn Theme and transparent for rest of pages?

Background image in Default home page Dawn Theme and transparent for rest of pages?

ddddrs
Tourist
5 0 1

Hi, I am using the following code below to maintain the header in one background and have another background image for the Default home page. However, the latter applies to all the other pages which I dont want to. 

 

What is the code to ONLY have a specific background image in the main page? And keep the rest of pages transparent background. 

 

Current code: 

 

.gradient {
background: var(--gradient-background);
background-attachment: fixed;
background-image: url([url of image]) !important;
background-color: transparent !important;
background-position: center !important;
background-repeat: no-repeat;
background-size: auto !important;
}

 


.header-wrapper{
background-image: url([url of image]);
background-repeat: no-repeat;
background-size: cover;
}

<body class= "{% if template == 'index' %} ADD class here{% endif %}">

/* Start */
header.site-header {height: 185px !important;}
@media only screen and (max-width: 768px){
header.site-header {height: 100px !important;}
.header-logo .lazyload__image-wrapper {max-width: 110px !important; }
header.site-header .header-logo { margin: 15px auto !important; }
header.site-header .site-header--text-links, header.site-header .site-header--text-links p {margin-bottom: 0px !important;}
}
/* End*/

 

 

Thank you! 

Replies 6 (6)

Made4uo-Ribe
Shopify Partner
7756 1876 2297

Hi @ddddrs 

Check this one. 

From your Shopify admin dashboard, click on "Online Store" and then "Themes"

Find the theme that you want to edit and click on "Actions" and then "Edit code".

In the "theme.Liquid" file. Find the </body> tag and paste the code below before the tag. 

 

{% if template == 'index' %}
<style>
.gradient {
background: var(--gradient-background);
background-attachment: fixed;
background-image: url([url of image]) !important;
background-color: transparent !important;
background-position: center !important;
background-repeat: no-repeat;
background-size: auto !important;
}
.header-wrapper{
background-image: url([url of image]);
background-repeat: no-repeat;
background-size: cover;
}
</style>
{% endif %}

 

And Save. 

This only will show on your homepage.

 

 

 

Please don't forget to Like and Mark Solution to the post that helped you. Thanks!

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free.
Need THEME UPDATES but has custom codes? No worries, contact us for affordable price.
ddddrs
Tourist
5 0 1

Thank you! and how can i make the background image fit correctly between the header and footer? right now it looks zoomed and also goes into the footer which i dont want to

Made4uo-Ribe
Shopify Partner
7756 1876 2297

It is smae on the code you provide. There is background-position: center. Can i take a look on your store? Thanks!

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free.
Need THEME UPDATES but has custom codes? No worries, contact us for affordable price.

Ambiancehome
New Member
6 0 0

I am looking for a code that makes my banner transparent in the default collection page

 

thank you!

Ambiancehome
New Member
6 0 0

Transparant Header**

Made4uo-Ribe
Shopify Partner
7756 1876 2297

Hi @Ambiancehome 

Do you mean te banner on the collection pages? 

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free.
Need THEME UPDATES but has custom codes? No worries, contact us for affordable price.