Topic on Project:Support desk

Add class to pages in specific wiki category

3
180.190.212.20 (talkcontribs)

How do I apply a class or script to pages under a certain cateogory only? When a category is created in wiki and pages are added to it, isn't there I classname I can use in to add style in Common.css to target pages under [[Category:Name]]?

Jonathan3 (talkcontribs)

I have a feeling this isn't possible.

It's possible to have CSS per namespace though.

Maybe the pages could be categorised via a template that contains the stuff you want (depending on what you want). Maybe you could then even use JavaScript to change things based on that.

180.190.212.20 (talkcontribs)

Thank you. Extension:TemplateStyles seems to be the answer. I also managed to do this by using this JS code:

$("#firstHeading:contains('keyword')")

Reply to "Add class to pages in specific wiki category"