Jump to content

Setting background color of text in front of an image (Farro template)

Recommended Posts

Site URL: https://chrysalis-collie-n4gg.squarespace.com/

Note the password to view my test site: ;WKy%,:PC3#8bjX:

The main page of my website (https://chrysalis-collie-n4gg.squarespace.com/work) has photos that you can click on to go to other pages (different categories of work). Each of these photos has a title shown over the lower part of it. I would like that text to be highlighted (i.e. the box behind the text should have a color and obscure that part of the photo it covers). Right now the text is black and sits in front of the photo. User tuanphan helped with a similar background color question last week. Unfortunately I have not had success adapting that solution for my new problem.

When I "view source" my page, I see that this text is written as a h2 with class Blog-title. For example:

<h2 class="Blog-title" data-content-field="title">The NPR Calendar</h2>

So I tried to use the "code injection" option to set the background color of h2s in the Blog-title class to be my specified color. Unfortunately, this code does not appear to do anything:

  h2.Blog-title {background: #F7E5EE !important;}  

I know the h2 specification is correct because if I specify e.g. color instead of background, it changes the font color correctly, and if I specify font-size it changes the font size. So I am definitely targeting the right part of the page, it is something about my use of background above which is called. I have also tried e.g. background-color, and not using !important. I am not sure what else it could be called or how to find out.

Does someone know what I am doing wrong here? 

Link to comment
  • Replies 2
  • Views 310
  • Created
  • Last Reply

You may want to use padding on the element like so


BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!


Link to comment


This topic is now archived and is closed to further replies.

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.