Forum Discussion

sfuaad's avatar
sfuaad
Contributor
9 years ago

How to change Category title background for each Category?

Hi

 

I need to change the category title background for each category using css. Currently If I change category title background in CSS it applies the change to all to categories on the forum but I want to make the change to individual category and not to all.

 

i have attached the screenshot for this. 

 

Thanks

Syed

 

 


  • sfuaad - You could use the context objects for this, such as

     

    <#if coreNode.id == "cat_1">

      //style for cat_1

    <#elseif coreNode.id == "cat_2">

      //style for cat_2

    <#elseif coreNode.id == "cat_n">

      //style for cat_n

    </#if>

     

    I know this might be difficult to scale, but unless you don't have unique classes for each the category in header, you cant't do it via CSS alone, and unfortunately, this is the case. Also, even in case of CSS, you'll have to update CSS for each new category, and same goes with this code So, you can include this code in header, where it will execute on each category page.

     

    Hope this helps.