You can target your CSS based on a specific tag or category.
There are two areas where you can add category / tag specific styles to topics.
-
In the topic list
We add both the topic’s category and its tags to the
<tr>
element that contains that item. So, a topic in the#meta
category that has the tagsautomotive
andmachines
will look like this in your browser inspection toolsif you want to target it based on the category, you would use
tr.category-meta
as your selector. If you want to target it based on the tagautomotive
, you would usetr.tag-automotive
and so on. -
On topic pages
We also do the same here. We add the relevant category and tag classes on topic pages. The only difference is that we add them to
<body>
tag instead. So, it looks like this
You can read more about how to add CSS to your Discourse site here