How to Change Background Color of Homepage Only?

Solved
Excursionist
95 0 7

We're changing our homepage image and want to change the background color to match. Our site is Brooklyn theme (Version 12.0.2). This feature isn't offered in "Customize" so it'll need to be custom-coded. I've tried a few things that didn't work. Does anyone have an idea how to institute this change?

0 Likes
Shopify Partner
1114 181 456

This is an accepted solution.

Please place this code at the end of index.liquid file

 

<style>
{% if template == 'index' %}
body {
background-color: #ededed; /* color hexcode   */
}
{% endif %}
</style>

 

 

Want to customize Shopify storefront? Check the PageFly app
75,000+ Active Shopify merchants. TOP5 best Shopify Apps.

Contact Me On : parambabla.soft@gmail.com
Excursionist
95 0 7

Worked perfectly. Thank you so much!

0 Likes
Shopify Partner
1114 181 456

Please accept it as solution

Want to customize Shopify storefront? Check the PageFly app
75,000+ Active Shopify merchants. TOP5 best Shopify Apps.

Contact Me On : parambabla.soft@gmail.com
0 Likes
Excursionist
28 0 5

Hi @paramSoft,

How can I do the same for mobile version? Your solution only worked for desktop version.

Thank you

0 Likes
Shopify Partner
1114 181 456

Please provide website url

Want to customize Shopify storefront? Check the PageFly app
75,000+ Active Shopify merchants. TOP5 best Shopify Apps.

Contact Me On : parambabla.soft@gmail.com
0 Likes