Can I add customized CSS style to certain categories?

Posted in: Newspaper
Post count: 42

Hi, Can I add customized CSS style to certain categories? The instruction for Customized CSS from the theme panel stated that the style will be used on all pages, but I only need it for certain categories. What would be the solution? Thanks very much!

Post count: 20688

Hi,

You can create your code so it applies only on the category pages you want. You can use the unique category IDs to make the code more specific. If you inspect a category page, it can be seen that the ID is displayed as a class on the body
https://www.screencast.com/t/yyqt6YccQ
So you can create your CSS code based on this ID. Here is more information about using the browser inspector
https://forum.tagdiv.com/create-custom-code-using-the-browsers-inspector/
In this example I have changed the color of the category description, only for a particular category page
https://www.screencast.com/t/xXCx8f7ojg

Thanks

Post count: 42

Thanks a lot! That’s very helpful!

Post count: 29

Hi Simion

In your example above the screen grabs are no longer available but I think this is what I am after, can you please confirm.

Can I depend on the id highlighted in this screenshot: https://snipboard.io/X5KwxV.jpg to apply style only to a specific category?

What I would like to do is to set the color of the page title based on category.

thanks

Post count: 35449

Hi,

Unfortunately this will not work as expected, that is a random class, it will change.
Please provide some more details about what you want to achieve and I will help you!

Thank you for your understanding!

Post count: 29

Hi Calin, thanks for your response.

I’ve created tagdiv cloud template for my category pages and I would like to set the color of the title on the pages based on the category. My hope is I can do this through css and not have to create a separate template for every category.

Brad.

Post count: 35449

Hi,

Yes, I think that you can do this using css, please provide me a link to your website and I will try to provide a the css.

Thank you!

Post count: 29

Hi thanks for your help with this.

https://island3.ulusolutions.com/

Categories: Parenting, Things To Do, Family Media

cheers

B.

Post count: 35449

Hi,

If you want to apply the background color only category pages, for category tags, then you can use the options from theme panel (without cloud template) -> https://i.imgur.com/qnC5aS2.png -> https://i.imgur.com/XxPH980.png if you are using a cloud template, you need to check the settings for style set on the category siblings -> https://i.imgur.com/199rSph.png
Now to change the page title color from each category you need to use a code like this -> https://i.imgur.com/MZea8V1.png for the above categories, you can use this custom css
.category-30 .tdb-title-text {
color: red;
}
.category-31 .tdb-title-text {
color: pink;
}
.category-32 .tdb-title-text {
color: green;
}

You can change the color, also you need to set the code in Theme Panel> Custom code> Custom css -> https://i.imgur.com/rDxfsI0.png

Hope this will help you!
Thank you!

Post count: 29

Thanks Calin this is what I was looking.

cheers

Brad.

Viewing 10 posts - 1 through 10 (of 10 total)
The forum ‘Newspaper’ is closed to new topics and replies.