Jump to content

Adding a colour background to the second text block on every blog post

Recommended Posts

Site URL: https://www.acrisl.org

Hello!

Apologies in advanced if I’m not using the right wording here. 

I built a website for a client, who wanted her blog pages to have a kind of ‘sidebar’, basically just a second column on every post with a coloured background to separate it from the rest of the text. So not quite the same as a blog sidebar which would have the same information across every post.

I achieved this using CSS. You can see an example of it in action here:

https://www.acrisl.org/casenotes/mudzuru-ampamp-another-v-ministry-of-justice-legal-ampamp-parliamentary-affairs-no-ampampothers-const-application-no-7914-cc-12-15-2015-zwcc-12-20-january2016ccz-122015

However, I have to target each block on every blog page in custom css. Now, she wants to upload blog items by herself, and the process is too complex for her to manage.

Here is an example of one without the background:

https://www.acrisl.org/casenotes/mudzuru-ampamp-another-v-ministry-of-justice-legal-ampamp-parliamentary-affairs-no-ampampothers-const-application-no-7914-cc-12-15-2015-zwcc-12-20-january2016ccz-122015-ghfkj

So I was thinking, I could target the 2nd text block using the following code, which doesn’t work:

.sqs-block-content:nth-of-type(2) {

background: #558462;

}

My other idea is to make a rule that every second column is a colour, but I have no idea how I would go about that.

Any help would be appreciated and happy to answer any questions to clarify what I mean.

Thank you!

Link to comment
  • Replies 4
  • Views 487
  • Created
  • Last Reply

Top Posters In This Topic

Ooh I think I worked it out:

 

// green blog columns //

.sqs-col-5 {
background: #558462 !important;
}

.sqs-col-5 p, {
color: white !important;
}

.sqs-col-5 p a, {
color: #323349 !important;
}

 

It would be nice to add padding to that text block, so if anyone has a better way of doing it, please do hit be up!

 

Link to comment
20 hours ago, sarahhalliday said:

Ooh I think I worked it out:

 

// green blog columns //

.sqs-col-5 {
background: #558462 !important;
}

.sqs-col-5 p, {
color: white !important;
}

.sqs-col-5 p a, {
color: #323349 !important;
}

 

It would be nice to add padding to that text block, so if anyone has a better way of doing it, please do hit be up!

 

Do you still need help?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
17 hours ago, sarahhalliday said:

If I could also have padding around the text on those columns, that would be great! Is there a way of doing this? 

Thank you!

Use this CSS

div#block-yui_3_17_2_1_1614871109870_6008 {
    padding: 30px;
}

https://www.acrisl.org/casenotes/mudzuru-ampamp-another-v-ministry-of-justice-legal-ampamp-parliamentary-affairs-no-ampampothers-const-application-no-7914-cc-12-15-2015-zwcc-12-20-january2016ccz-122015

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (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.