# How can I customise CSS for each category? (as in having different design for each category)

**URL:** https://meta.discourse.org/t/how-can-i-customise-css-for-each-category-as-in-having-different-design-for-each-category/35822
**Category:** Development
**Created:** [Novembro 19, 2015, 11:51pm UTC](https://meta.discourse.org/t/how-can-i-customise-css-for-each-category-as-in-having-different-design-for-each-category/35822 "2015-11-19T23:51:54Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Huey\_Le](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/huey_le/32/63362_2.png) [@Huey\_Le](https://meta.discourse.org/u/Huey_Le)
#### Post date: [Novembro 19, 2015, 11:51pm UTC](https://meta.discourse.org/t/how-can-i-customise-css-for-each-category-as-in-having-different-design-for-each-category/35822/1 "2015-11-19T23:51:54Z")

</div>

Hi, I’m running a game forum and I’d like to be able to customise CSS for each category so that each category will look different with each other (example: Fallout 4 category can have more post-nuclear design, Halo category will have futuristic design,etc…) Currently the CSS customize in Admin affect all categories. Any possible way to change css for each category without affecting other category?

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [Novembro 19, 2015, 11:59pm UTC](https://meta.discourse.org/t/how-can-i-customise-css-for-each-category-as-in-having-different-design-for-each-category/35822/2 "2015-11-19T23:59:54Z")

</div>

Isn’t it only a matter of using the correct selector(s)?

eg. the body tags class value should have a category specific value you could use.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [Novembro 20, 2015, 4:15pm UTC](https://meta.discourse.org/t/how-can-i-customise-css-for-each-category-as-in-having-different-design-for-each-category/35822/4 "2015-11-20T16:15:12Z")

</div>

When you’re in a category, discourse adds the category slug to the body element. For example, on meta here when I visit the bug category I get `category-bug` in the body tag. If you use that as a selector you can style each category differently.

---

<div class="post-metadata">

### Author: ![Huey\_Le](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/huey_le/32/63362_2.png) [@Huey\_Le](https://meta.discourse.org/u/Huey_Le)
#### Post date: [Novembro 23, 2015, 5:39am UTC](https://meta.discourse.org/t/how-can-i-customise-css-for-each-category-as-in-having-different-design-for-each-category/35822/5 "2015-11-23T05:39:13Z")

</div>

Thanks for the info. I will try it out

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [Novembro 25, 2018, 2:01am UTC](https://meta.discourse.org/t/how-can-i-customise-css-for-each-category-as-in-having-different-design-for-each-category/35822/6 "2018-11-25T02:01:08Z")

</div>



---

<div class="post-metadata">

### Author: ![ylluminate](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ylluminate/32/115440_2.png) [@ylluminate](https://meta.discourse.org/u/ylluminate)
#### Post date: [Novembro 25, 2018, 5:20am UTC](https://meta.discourse.org/t/how-can-i-customise-css-for-each-category-as-in-having-different-design-for-each-category/35822/7 "2018-11-25T05:20:10Z")

</div>

I’m really curious about this one in terms of steps on customizing a Discourse system similar to how [https://forums.funcom.com/](https://forums.funcom.com/) has customized their system (notice how wonderfully customized each section is by going between [Conan Exiles](https://forums.funcom.com/c/conan-exiles) and [Mutant Year Zero](https://forums.funcom.com/c/mutant-year-zero)).

Any particularly thorough tutorials floating around? I’m seeing [a number of them](https://duckduckgo.com/?q=discourse+customization+tutorial&t=h_&ia=web), but I’d like to know if any really stick out or are especially authoritative when it comes to what Funcom has done.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [Novembro 25, 2018, 12:06pm UTC](https://meta.discourse.org/t/how-can-i-customise-css-for-each-category-as-in-having-different-design-for-each-category/35822/8 "2018-11-25T12:06:27Z")

</div>

Perhaps this is one that should be on the default customer page @awesomerobot and @HAWK?

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [Novembro 26, 2018, 8:33pm UTC](https://meta.discourse.org/t/how-can-i-customise-css-for-each-category-as-in-having-different-design-for-each-category/35822/9 "2018-11-26T20:33:19Z")

</div>

It’s a surprisingly simple customization — they’ve designed their base theme to work well with background images, and the images themselves are applied per-category (and the images are where most of the style comes from). This CSS accomplishes most of the work:

```CSS

// This adds a background color to topic lists, so they're readable when there's a background image
tbody { 
    background-color: rgba(30,30,30,0.8);
}

// This adds a background color to topics that fades on the right 
.posts-wrapper { 
    background: linear-gradient(to right, rgba(31,34,37,0.95) 0%,rgba(0, 0, 0, 0.83) 80%,rgba(0,0,0,0) 100%);
}

body.category-staff { // Replace staff with the name of your category
   background-image: url(https://yourimagehere.jpg); // Add your category-specific background image
}

```

---

<div class="post-metadata">

### Author: ![AndreSpecker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andrespecker/32/139050_2.png) [@AndreSpecker](https://meta.discourse.org/u/AndreSpecker)
#### Post date: [Outubro 4, 2019, 2:44pm UTC](https://meta.discourse.org/t/how-can-i-customise-css-for-each-category-as-in-having-different-design-for-each-category/35822/10 "2019-10-04T14:44:29Z")

</div>

Alguém tem um CSS para chegar perto disso??

 ![image](https://global.discourse-cdn.com/meta/original/3X/0/8/085344a4b3621458e624b355f53f5365e5d9d564.png)

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [Outubro 4, 2019, 3:10pm UTC](https://meta.discourse.org/t/how-can-i-customise-css-for-each-category-as-in-having-different-design-for-each-category/35822/11 "2019-10-04T15:10:35Z")

</div>

Se você abrir o inspetor do navegador para ver esses elementos, encontrará também todo o CSS relacionado.

---

<div class="post-metadata">

### Author: ![AndreSpecker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andrespecker/32/139050_2.png) [@AndreSpecker](https://meta.discourse.org/u/AndreSpecker)
#### Post date: [Outubro 4, 2019, 5:54pm UTC](https://meta.discourse.org/t/how-can-i-customise-css-for-each-category-as-in-having-different-design-for-each-category/35822/12 "2019-10-04T17:54:38Z")

</div>

Eu fiz isso no Paint 😅 os de cima estão como estão atualmente, e os de baixo como eu gostaria que fossem

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [Junho 5, 2023, 4:03am UTC](https://meta.discourse.org/t/how-can-i-customise-css-for-each-category-as-in-having-different-design-for-each-category/35822/13 "2023-06-05T04:03:30Z")

</div>



---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [Junho 5, 2023, 4:04am UTC](https://meta.discourse.org/t/how-can-i-customise-css-for-each-category-as-in-having-different-design-for-each-category/35822/14 "2023-06-05T04:04:29Z")

</div>


