# Custom header and css

**URL:** https://meta.discourse.org/t/custom-header-and-css/258920
**Category:** Development
**Created:** [March 21, 2023, 4:37pm UTC](https://meta.discourse.org/t/custom-header-and-css/258920 "2023-03-21T16:37:04Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![per\_coh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/per_coh/32/271009_2.png) [@per\_coh](https://meta.discourse.org/u/per_coh)
#### Post date: [March 21, 2023, 4:37pm UTC](https://meta.discourse.org/t/custom-header-and-css/258920/1 "2023-03-21T16:37:04Z")

</div>

Hi folks, trying to add a custom header at the top. It’s mostly working but some of the CSS, I think, is being overwritten by Discourse.  
Is there a trick to block Discourse’s CSS from affecting my header?

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [March 21, 2023, 9:07pm UTC](https://meta.discourse.org/t/custom-header-and-css/258920/2 "2023-03-21T21:07:47Z")

</div>

Hello 👋

Can you share your CSS modifications?

Usually, Discourse will override our rules if our selectors aren’t precise enough.

For example, if Discourse has a rule like `body .category { line-height: 1 }` and we write in our own theme `.category { line-height: 2 }`, then it will be overriden by the first rule because it’s more precise with the additional `body` selector.

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [March 21, 2023, 10:15pm UTC](https://meta.discourse.org/t/custom-header-and-css/258920/3 "2023-03-21T22:15:09Z")

</div>

From what I have read there is also the “! Important” used in css?

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [March 21, 2023, 10:25pm UTC](https://meta.discourse.org/t/custom-header-and-css/258920/4 "2023-03-21T22:25:07Z")

</div>

Yes. I would not recommend using it unless you can’t override CSS by using selectors though. It’s a “last resort” rule. 🙂

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [March 21, 2023, 10:58pm UTC](https://meta.discourse.org/t/custom-header-and-css/258920/5 "2023-03-21T22:58:27Z")

</div>

Cool thank you for the clarification. I have seen it often recommended for addon components to influence/change a #Customization > Theme component

---

<div class="post-metadata">

### Author: ![per\_coh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/per_coh/32/271009_2.png) [@per\_coh](https://meta.discourse.org/u/per_coh)
#### Post date: [March 23, 2023, 8:44am UTC](https://meta.discourse.org/t/custom-header-and-css/258920/6 "2023-03-23T08:44:21Z")

</div>

Thanks for replying everyone. I’m familiar enough with CSS to know the standard tricks and such. Sorry if that doesn’t sound too nice, I don’t mean it that way.  
I was really just hoping Discourse had some setting somewhere to force its own css to ignore custom containers with specific ids or classes. It would really save a lot of time.  
Anyway, think I got most of it; and I’ll just have to keep an eye on any major CSS changes Discourse add along the way and compensate.
