Jump to content

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

Go to solution Solved by Beyondspace,

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:

<style>
  h2.Blog-title {background: #F7E5EE !important;}  
</style>

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? 

Edited by katieburk
Link to comment
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

  • Solution

You may want to use padding on the element like so

image.thumb.png.bc8077b13f3677126802bec74ce5f208.png

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • 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.