# Show topic count in category list

**URL:** <https://meta.discourse.org/t/show-topic-count-in-category-list/160857>\
**Category:** Product Support\
**Created:** [August 14, 2020, 11:22am UTC](https://meta.discourse.org/t/show-topic-count-in-category-list/160857 "2020-08-14T11:22:19Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Aaron\_Walsh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aaron_walsh/32/312661_2.png) [@Aaron\_Walsh](https://meta.discourse.org/u/Aaron_Walsh)\
**Post date:** [July 30, 2024, 6:19pm UTC](https://meta.discourse.org/t/show-topic-count-in-category-list/160857/8 "2024-07-30T18:19:24Z")

</div>

Hi, sorry I missed this. Try this one for CSS.

To create a CSS that shows the topic count in the subcategory on Discourse, you’ll need to target the specific elements in the Discourse DOM that represent the count of topics for a subcategory. Below is a CSS example that you can apply via the admin interface in Discourse.

1. **Navigate to the Admin Customize Section** :

2. **Add Custom CSS** :

```css
/* Custom CSS to show topic count in subcategory */
.subcategory {
    position: relative;
    padding-right: 40px; /* Adjust as needed for spacing */
}

.subcategory .subcategory-details .topics {
    font-size: 0.8em; /* Makes the topic count slightly smaller */
    color: #666; /* Use a color that matches your theme */
    position: absolute;
    top: 50%;
    right: 10px; /* Place it on the right of the subcategory */
    transform: translateY(-50%);
    background: #f2f2f2; /* Background color to make it stand out */
    padding: 2px 5px;
    border-radius: 3px; /* Rounded corners for a better look */
}

.subcategory:hover .subcategory-details .topics {
    background: #ddd; /* Change background color on hover, if desired */
}

```

1. **Save the Changes** :
  - Click on the `Save` button to apply the custom CSS.

The CSS above assumes the existing structure of subcategories in Discourse. You might need to inspect the HTML structure using browser developer tools (right-click and Inspect in most browsers) and modify the CSS selectors accordingly based on the actual DOM structure of your Discourse setup.

In Discourse, subcategories typically have the class `.subcategory` and topic counts might be inside certain element structures that you can target with more specific CSS if necessary. Ensure that elements like `.topics`, `.subcategory-details`, and their hierarchical structures match what is in your platform for accurate styling.

---

_[View the full topic](https://meta.discourse.org/t/show-topic-count-in-category-list/160857)._
