Jump to content

coloured category boxes for blog

Recommended Posts

Posted

Hi

I want to create buttons around the blog categories at the top of each blog post as well as the main blog page on my site. Each category needs a different colour background. I have managed to do this in the summary block (elsewhere on the site) but not on the blog page itself.

I would also like to remove the comma between the categories. Is this possible?

Below is the code I have used for one of the categories.

.summary-metadata-item--cats a[href*="category=health"]{
  background-color:#F4F7DE;
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 12px;
  font-weight: 400;
   padding: .4em .7em;}

Any help I can get would be great!

Many thanks 🙂

 

Capture.PNG

Capture1.PNG

Capture2.PNG

Posted

Please share a link to the page.

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Posted
13 hours ago, trs27 said:

You can use this CSS code

a.blog-categories[href="/blog/category/calm"] {
    background-color: #f1f5f8;
    padding-left: 5px;
    padding-right: 5px;
}
a.blog-categories[href="/blog/category/health"] {
    background-color: #f8f9e9;
    padding-left: 5px;
    padding-right: 5px;
}

 

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!)

Posted
20 hours ago, trs27 said:

I would also like to remove the comma between the categories.

You can remove the commas with the following CSS:

/* Hide commas in blog categories */
.blog-categories--comma {
  display:none;
}

Did this help? Please give feedback by clicking an icon below  ⬇️

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

  • 7 months later...
Posted (edited)

@tuanphan @paul2009

This is the code I am using to colour code my blog categories:
 

/* Colour code blog categories */

a.blog-categories[href="/blog/category/Empowering+Our+People"] {
    background-color: #346bd2;
    color: #FFFFFF;
    font-weight: bold;
    padding-left: 5px;
    padding-right: 5px;
}

 

This is the code I am using to accomplish the same concept in the summary block:

.summary-metadata-item--cats a[href*="category=Empowering+Our+People"]{
  background-color: #346bd2;
  color: #FFFFFF;
  font-family: futura;
  font-weight: bold;
  font-size: 12px;
  padding: .4em .7em;}

For some reason, the same hex codes are showing up faded in the summary block. Is there a better way of doing this? 

 

 

Edited by collgrimes
Posted
1 hour ago, collgrimes said:

For some reason, the same hex codes are showing up faded in the summary block. Is there a better way of doing this?

This is because the .summary-metadata-item class has an opacity of 0.7 set. If you change this to 1, it will remove the "fade". For example:

.sqs-block-summary-v2 .summary-metadata-item {
  opacity: 1;
}

Did this help? Please give feedback by clicking an icon below  ⬇️

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

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.