Hi! I’m trying to add an image as my background for the homepage only in Craft theme. I would like the image to cover the entire background including the header section. Can anyone help me figure out how to do this. Ive tried finding tutorials but they are too confusing and I don’t have the theme.css asset. I also don’t want it on every page just the background. Is this possible?
HI @BlakeandRob
If you have the code, you can try to add the code into the bottom of the file base.css
Look for something similar to a theme.css by just typing css in that same search window.
It might be base.css
But take a look at this article, does it help you successfully add an image to the background of your homepage in Shopify Craft theme??
Hi Sarah! I tried adding the code like the article says but nothing happens. I tried adding to the end of base.css but still nothing changes.
Hi! Ive tried a couple of codes but so far neither works. I cannot find the theme.css asset and judging from the articles Ive found online, it seems like it has been removed from the Craft theme. Is there a certain code you could recommend that I could try?
Hi @BlakeandRob
Please share your store URL, page URL and also password (if your store has one) so we can help you.
I did a fresh install and a quick check on the code below.
How to change your Shopify Craft theme background for the homepage only
-
In “edit code”
-
Open theme.liquid
-
Find the opening tag for
4. Add a 2nd class name, I use pic as the example
-
Scroll to the end of theme.liqud
-
Find the line before and ADD
if statement plus the CSS to make your homepage background an image
{% if template == "index" %}
{% endif %}
Note.
If you remove the gradient class, and just keep your new class, it will change the Craft theme background for all pages
Apologies for the terrible formatting, I kept getting an error or the ordered list would change between compose and preview.