[Resolved] Different color per category

Home Forums Support [Resolved] Different color per category

Home Forums Support Different color per category

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2049320
    Tri Ryuzaki

    Hi there, how can I define different color for each category on blog archive (as well as on single post page). Thanks

    View post on imgur.com

    https://fiverrguy.com/blog/

    #2049379
    Elvin
    Staff
    Customer Support

    Hi there,

    You can style these links through their href attribute. (category slug)

    Example:

    #main span.cat-links a[href*="affiliate-marketing"] {
        background-color: red;
        color: white;
    }
    
    #main span.cat-links a[href*="on-page-seo"] {
        background-color: blue;
        color: white;
    }

    You create a CSS entry for each category you want to style. ๐Ÿ˜€

    #2049389
    Tri Ryuzaki

    Hi Elvin, it works perfectly on the default blog page, thanks. How can I achieve the same effect on the custom blocks / layouts which are created with “Element Blocks”?. For example, the post header is created using Block Element (Page Hero type), and the category is created by using “Headline” block element, how can we achieve the same effect on those custom category text?

    View post on imgur.com

    https://fiverrguy.com/how-to-make-a-graph-in-google-sheets/

    #2049398
    Elvin
    Staff
    Customer Support

    We can modify the format of the code to something like this:

    #main span.cat-links a[href*="affiliate-marketing"],
    .dynamic-term-class a[href*="affiliate-marketing"] {
        background-color: red;
        color: white;
    }
    
    #main span.cat-links a[href*="on-page-seo"],
    .dynamic-term-class a[href*="on-page-seo"] {
        background-color: blue;
        color: white;
    }
    #2049410
    Tri Ryuzaki

    Hi, it works great, thank you =)

    #2049413
    Elvin
    Staff
    Customer Support

    No problem. ๐Ÿ˜€

    #2312310
    Jens

    The code doesn’t change the color of the .dynamic-term-class but only the background color of the text.

    #2312412
    David
    Staff
    Customer Support

    Hi there,

    can you raise a new topic and share a link to your site where we can see the issue ?

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.