The discussion revolves around highlighting topics with a specific tag, such as ‘advertisement’, in the topic list view using CSS or JavaScript. tomwrench requests a way to visually distinguish these topics with a light yellow background. codinghorror notes that while tags don’t have direct CSS classes, category CSS classes are available. Hammad_Abbasi suggests using CSS selectors like badge-category[title="tag-title"] to style tags, but acknowledges that styling entire rows requires JavaScript, providing a code snippet to highlight topics with a ‘new’ tag. zogstrip proposes adding a class for each tag (e.g., tag-<name>) to the topics list. maja confirms the implementation by adding tag classes via a GitHub commit.
I’m wanting to highlight topics with a certain tag with a different background colour in the topic list view. In my case, I’ve tagged “advertisement” type topics with ‘advertisement’ and I would like them to be highlighted a light yellow on the topic list view to stand out, as per my mockup below. Would there be a CSS hack (or otherwise) to achieve this?
Tags have title attribute so you can use css selector (badge-category[title=“tag-title.”] ) to apply any style on them but if you want to highlight the entire row then you have to select parent which i don’t think is possible via css.
I would use javascript to achieve this
var allrows =document.querySelectorAll("a[title=\"new topic\"]");
for( i in allrows) {allrows[i].parentNode.parentNode.style.backgroundColor="#FFFFE0";}
@maja if the data is already being serialized to the client, can you ensure the topics have a class for each tags (eg. tag-<name>) in the topics list view?