# How to target specific CSS elements?

**URL:** https://meta.discourse.org/t/how-to-target-specific-css-elements/147084
**Category:** Support
**Created:** [April 7, 2020, 4:33am UTC](https://meta.discourse.org/t/how-to-target-specific-css-elements/147084 "2020-04-07T04:33:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Denis\_Heraud](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denis_heraud/32/119623_2.png) [@Denis\_Heraud](https://meta.discourse.org/u/Denis_Heraud)
#### Post date: [April 7, 2020, 4:33am UTC](https://meta.discourse.org/t/how-to-target-specific-css-elements/147084/1 "2020-04-07T04:33:04Z")

</div>

I want to target a specific element to modify its properties (for example):

```
.d-button-label { display: none !important;}

```

But then realized it’s used all over the place in Discourse, not just in the plugin element I was trying to customize. So how would I go about targeting that specific label?

 ![Screen Shot 2020-04-06 at 10.35.15 PM copy](https://global.discourse-cdn.com/meta/original/3X/6/e/6eb372d7b45aa17f165c01b9da631b2151e74d07.png)

 ![Screen Shot 2020-04-07 at 12.22.13 AM](https://global.discourse-cdn.com/meta/original/3X/e/9/e9201b809057f7d756de8efa7d1c9aa2c106b200.png)

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [April 7, 2020, 7:06am UTC](https://meta.discourse.org/t/how-to-target-specific-css-elements/147084/2 "2020-04-07T07:06:32Z")

</div>

You go up in the HTML tree and find a parent with a unique class.

You can then add the parent to your selector like so

```css
.parent-class .child-class {
  display: none;
}

```

You can also add more unique parent classes like so

```css
.grandparent-class .parent-class .child-class {
  display: none;
}

```

If needed.

The same thing in SCSS would look like this

```scss
.grandparent-class {
  .parent-class {
    .child-class {
      display: none;
    }
  }
}

```

This should eliminate the need to use `!important`

---

<div class="post-metadata">

### Author: ![Denis\_Heraud](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denis_heraud/32/119623_2.png) [@Denis\_Heraud](https://meta.discourse.org/u/Denis_Heraud)
#### Post date: [April 7, 2020, 12:33pm UTC](https://meta.discourse.org/t/how-to-target-specific-css-elements/147084/3 "2020-04-07T12:33:28Z")

</div>

Thank you @Johani! You just taught me something new that will come in very handy!

---

<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: [April 29, 2024, 8:32pm UTC](https://meta.discourse.org/t/how-to-target-specific-css-elements/147084/4 "2024-04-29T20:32:17Z")

</div>


