How to add a custom background image to any Shopify theme [Updated 2023]

Tired of the plain white background of your theme? Having a neat-looking background image on your website can be a bold way to establish your brand: a well thought beautiful image, abstract or not, carries power with it.

One important thing to understand is that most modern Shopify themes are built on top of sections, therefore adding a background image to the website itself would unlikely yield any results.

As an example, imagine you're placing lego blocks on top of an orange lego wall. Although the wall is orange, the other lego pieces will be on top of it so you won't be able to say see that it is orange. In this analogy, the wall is your <body> tag and the other pieces are the Shopify sections.

Therefore, in this tutorial we'll cover how you can add an image to both the website (the orange lego wall) and how you can add an image to each individual section (the lego pieces). At the end we'll also take a look into optimizing your image's performance.

Upload the image to your website

First things first, let's upload the image that will be shown on your website. To do this is, we'll use the Shopify store's file storage.

  1. From your admin page, navigate to Content > Files.


  2. On the top right, click on Upload Files and upload the image you'd like to use as a background. In this case, we'll use this forest image.


  3. Please keep the link of the image you'll want to use accessible. You may want to leave this tab open or save the link somewhere.


Adding the image to the website's body

Firstly let's add the image to the website's body, which would be the equivalent to the orange lego wall in our previous analogy. If you'd like to add the image only to a specific section instead please skip to the next part.

  1. From your Shopify admin, navigate to online store > themes > actions > edit code
  2. Click on Add a new snippet and create a snippet named exactly:

    ezfy-background-image

  3. Paste the following code inside this newly created file:


  4. Replace the text that says “replaceme.jpg” with the image URL that you copied beforehand. Make sure it is also between quotes.



  5. Find the theme.liquid file;
  6. Within the theme.liquid file you found, press CTRL + F and search for:

    <body
  7. Paste the following code right below it.

    {% include 'ezfy-background-image' %}

This will add a background image to the body plus all sections except the header, announcement bar and the footer. This is how it looks like on the Dawn theme:


In case this is not working, take a look at the next part where we will add an image to an individual section.

Don't forget to delete the line “{% include 'ezfy-background-image' %}” from the theme.liquid file if you won't use the code above. You can also delete the “ezfy-background-image” file if you wish, but deleting only this line will ensure that the website's performance is not impacted.

Adding the image to individual sections

Now let's add a background image to an individual section. Here is how you do it:

  1. From the edit code page, on the top left, click on the three dots and Customize.

  2. Choose the section you'd like to add a background to. In this case, I'll be adding a custom background to our copy/paste Collections Tabs section.

  3. Scroll all the way down until you find “Custom CSS”.
  4. Paste the following code. Remember to replace the “replaceme.jpg” with your image's URL:

    > * { background: url("replaceme.jpg") !important; }
  5. You should see the changes immediately. I think we can all agree this is not the most elegant choice of background for this specific section but, hey, it works!

Keeping performance in mind

In this tutorial I used a JPG image that's 1.78mb. For the sake of learning this is fine, but in a real world store you don't want to use images that large, especially as a background image.

I would recommend an image that is at most 500kb, also make sure you use .webp instead of .jpg. WEBP performs much better.

If you're working alongside a developer you may also want to look into developing a custom choice for your theme where you can implement lazyloading, add a custom field to quickly upload images at the customize page and some other additional functionalities to easily A/B test what works the best for your business.

Final thoughts

Adding a background image to certain themes may require a different approach, unfortunately it's difficult to develop an “one size fits all” solution. If the tutorial didn't work, kindly let us know in details what is the issue you are having and the theme you are using in the “was this article helpful” box. We'll do our best to keep this guide as helpful and update as possible.

More copy/paste tutorials

– How to make slideshow images stop cutting off
– How to add a collection with tabs section to any theme (copy/paste, no apps, blazing fast)


Shop

You may also like

Here are some other blog posts you may be interested in.

Customers'Recommendations

Testimonials

Our clients' satisfaction is our main priority.

Danail Ilev's on Facebook.

DanailIlev

Sofia, Bulgaria

10/10!!! Customization and bug repairs that were impossible for a few previous devs of mine were an easy task for Diego! Honestly cannot recommend him enough. If you like testing different tweaks on your site or have an annoying bug - he's the man. Also his response time is of the charts + same day delivery (Amazon of devs 😁)
Review source
Brogan Domaschenz's on Facebook.

BroganDomaschenz

Australia

VERY VERY IMPRESSED! - understood exactly what i was trying to get across and produced something even better then i could of imagined in a shorter time frame then expected and in a very professional manner. Even though its the festive season, and i needed the coding done urgently, you were quick to respond and get in and get the job done, sacrificing your own holiday time, you absolutely went above and beyond all expectations. I cant recommend you enough!!! 🔥🔥🔥 Top Bloke!
Review source
Mackenzie Dodge's on Facebook.

MackenzieDodge

Colorado, USA

Diego was so easy to work with, I literally had the code to fix the announcement banner on our shopify store in less than 15 minutes! From the time I messaged him on FB to the time I had the code with instructions in my email I barely had time to get coffee! Plus payment was affordable and easy! I wish I had the week back I tried to fix it myself. Will definitely message them FIRST in the future!
Review source
Ibraheem Nadeem's on Facebook.

IbraheemNadeem

Michigan, USA

Diego is amazing at what he does. I've been using his web development services for over a year (I have 20+ projects completed with the EZFY team) and he is always super helpful. His CRO tips are incredible and have definitely helped my conversion rates! Super fast turn around time and always willing to help with support after the project is done. HIGHLY Recommend Diego and the EZFY team for all your Shopify web development needs!
Review source
Anna Dineva's on Facebook.

AnnaDineva

Paris, France

Diego is great ! Very responsive and customizes everything to your wish. Very friendly and comprehensive, + the delivery is immediate. I enjoy a lot working with him ! Recommend 100% !
Review source
Matt Reseigh's on Facebook.

MattReseigh

Adelaide, Australia

Diego was extremely accommodating and easy to work with. He has an extensive amount of knowledge and is willing to go above and beyond. I will certainly be using his services again in the future. Highly recommend!
Review source
Ronny Berco's on Facebook.

RonnyBerco

Toronto, Ontario

Incredible work - I got them to help fix some things on my Shopify store and for such a great price! They were extremely fast and went above and beyond in filling my request. On top of that they made even more great suggestions on fixes I can do for the site. Thanks! Will definitely work with you again.
Review source
Mev Omie's on Facebook.

MevOmie

Melbourne, Australia

One of the best website developers out there! Always on time and exceeds expectations!
Review source
Daniel Walker's on Facebook.

DanielWalker

Melton, Australia

Super happy with Diego’s work! He was quick to help out, easy to communicate with, and finished the work I needed at a very high standard! Thank you Diego!
Review source
Wei Tan's on Facebook.

WeiTan

Australia

Diego is a great resource. He's prompt and highly accommodating, which all leads to a great end result. Highly recommended!
Review source
Shawn Pansiri's on Facebook.

ShawnPansiri

Working with Diego was one of the best experiences I have ever had he is a professional and knows his stuff, anything you ask he will get it done he will also go out of his way and help you out if your knowledge is limited in some areas. One of the best hires I have come across and will hire in a heartbeat. Keep up the good work Diego!
Review source
Jeffrey Richardson's on Facebook.

JeffreyRichardson

Toronto, Ontario

This team went FAR beyond my expectations! It felt as if i had another employee, instead of a service. Their recommendations and exceptional work made my project come out perfectly. Their ability to show me examples, modify at no cost and finish everything extremely fast was amazing. will work with these guys for now on.
Review source
Conny Segervall's on Facebook.

ConnySegervall

Nykarleby, Finland

Hands down the best agency I have ever worked with. Always happy with the awesome results :)
Review source
Richard Agyemang's on Facebook.

RichardAgyemang

Philadelphia, USA

He is the best at what he does. I have worked with a couple of developers but he is by far the best. Thanks for such an amazing job on my site. I 100% recommend him
Review source

Contact Us

Let us know what type of customizations you're looking for.

Send us an e-mail and we'll get back to you within 24 hours! Before you click on "send message" please make sure to do the ReCaptcha so your e-mail can be sent safely.

Loading...