# Making custom CSS changes on your site

**URL:** https://meta.discourse.org/t/making-custom-css-changes-on-your-site/168101
**Category:** Site Management
**Tags:** css, how-to
**Created:** [October 23, 2020, 8:49pm UTC](https://meta.discourse.org/t/making-custom-css-changes-on-your-site/168101 "2020-10-23T20:49:34Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [October 23, 2020, 8:49pm UTC](https://meta.discourse.org/t/making-custom-css-changes-on-your-site/168101/1 "2020-10-23T20:49:35Z")

</div>

> 🔖 This guide explains how to make CSS changes on your Discourse site, including an introduction to CSS, where to add CSS in Discourse, and how to find the right selectors using browser inspection tools.
> 
> 🙋 Required user level: Administrator

## Summary

This guide covers:

1. A brief introduction to CSS and key concepts
2. How to add CSS to your Discourse site using theme components
3. Using browser inspection tools to find the right CSS selectors

## Understanding CSS basics

CSS stands for Cascading Style Sheets. Here are three key concepts to understand:

1. **Structure** : A CSS rule consists of a selector, property, and value.

```css
p {
  color: red;
}

```

- Selector: `p` (targets all HTML `<p>` tags)

- Property: `color`

- Value: `red`

1. **Cascade** : The last rule applied takes precedence. For example:

```css
p {
  color: red;
}
p {
  color: green;
}

```

The paragraphs will be green because it’s the last rule applied.

1. **Specificity** : More specific rules override less specific ones. For example:

```css
div p {
  color: green;
}
p {
  color: red;
}

```

Paragraphs inside divs will remain green because `div p` is more specific than `p`.

## Adding CSS to your Discourse site

To add CSS to your Discourse site:

1. Go to `Appearance > Themes & components` from the Admin navigation sidebar and click the **Components** tab. (Or follow this url for your site: `https://yoursite.com/admin/config/customize/components`)

2. Click Install then ➕ Create New

3. Name your theme component and click Create 

4. Choose the theme(s) where the component will be applied and click the green checkmark icon to save your selection

⚠ If you have multiple user-selectable themes, make sure to add your theme components to all relevant themes.

1. Click Edit Code

2. Add your CSS to the CSS tab

3. Click “Save” to apply your changes.

## Finding the right CSS selectors

Use browser inspection tools to find the correct CSS selectors:

1. Right-click on the element you want to modify.

2. Select “Inspect” from the context menu.

3. In the developer tools panel, locate the element selectors.

4. Click the respective selectors and add your CSS rule.

5. Copy the rule, paste it into your theme component’s CSS section and remove conflicting rules.  

For more specific selectors, you may need to copy the selector used in Discourse’s existing styles and modify it in your theme component.

Here’s a video demonstrating the above steps:

## Troubleshooting

If your changes aren’t applied, confirm that:

- The theme component is enabled on all relevant themes
- Your CSS rule is specific enough to override existing styles

## Additional resources

- [MDN CSS Documentation](https://developer.mozilla.org/en-US/docs/Web/CSS)
- [Chrome DevTools Documentation](https://developers.google.com/web/tools/chrome-devtools)
- [Freecodecamp](https://forum.freecodecamp.org/)
- [Beginner’s Guide to Using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966)

> Last edited by @southpaw 2025-11-17T18:54:52Z
> 
> Last checked by @hugh 2024-10-29T00:18:45Z
> 
> > **Check document**
> >
> > Perform check on document:

---

<div class="post-metadata">

### Author: ![traceymoko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/traceymoko/32/483235_2.png) [@traceymoko](https://meta.discourse.org/u/traceymoko)
#### Post date: [April 7, 2024, 4:05am UTC](https://meta.discourse.org/t/making-custom-css-changes-on-your-site/168101/14 "2024-04-07T04:05:18Z")

</div>

Could this be made a wiki? The info under the heading Where Do I Add My CSS? needs updating, because there is no more Edit CSS/HTML button if you installed an existing theme — which is likely now if someone chose a theme through the newer Setup Wizard. Now we just use theme components that will be added to existing themes.

[https://meta.discourse.org/t/make-css-changes-on-your-site/168101#where-do-i-add-my-css-5](https://meta.discourse.org/t/make-css-changes-on-your-site/168101#where-do-i-add-my-css-5)

I can update it once it’s made into a wiki.

---

<div class="post-metadata">

### Author: ![traceymoko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/traceymoko/32/483235_2.png) [@traceymoko](https://meta.discourse.org/u/traceymoko)
#### Post date: [April 7, 2024, 8:00am UTC](https://meta.discourse.org/t/making-custom-css-changes-on-your-site/168101/15 "2024-04-07T08:00:26Z")

</div>

Ok this is done now 👍

---

<div class="post-metadata">

### Author: ![dontdieych](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dontdieych/32/114749_2.png) [@dontdieych](https://meta.discourse.org/u/dontdieych)
#### Post date: [December 30, 2025, 5:52am UTC](https://meta.discourse.org/t/making-custom-css-changes-on-your-site/168101/17 "2025-12-30T05:52:32Z")

</div>

Thank you. Thanks to this part, I finally got the answer I wanted.

I needed a Discourse instance for various personal uses, so I installed it on a VPS a few days ago.

The text color in read topic was displaying too faintly, so I was searching for a solution. I had no idea there was a custom CSS setting under the ‘Component’ section.

I achieved the desired result with the following CSS. If anyone knows a better method, please leave a comment.

```css
.topic-list-item.visited a.title:not(.badge-notification),
.latest-topic-list-item.visited a.title:not(.badge-notification),
.category-topic-link.visited a.title:not(.badge-notification),
{
  color: #000000;
}

```

 ![Screenshot_2025-12-30_14:52:01](https://global.discourse-cdn.com/meta/original/4X/4/3/f/43f395e790b4f5e5ab7f5c2c3ba4187f1ead774b.png)
