# CSS behavior changed after software update

**URL:** <https://meta.discourse.org/t/css-behavior-changed-after-software-update/181293>\
**Category:** UX\
**Created:** [February 27, 2021, 2:10am UTC](https://meta.discourse.org/t/css-behavior-changed-after-software-update/181293 "2021-02-27T02:10:00Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![littleviolette](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@littleviolette](https://meta.discourse.org/u/littleviolette)\
**Post date:** [February 27, 2021, 2:10am UTC](https://meta.discourse.org/t/css-behavior-changed-after-software-update/181293/1 "2021-02-27T02:10:00Z")

</div>

I updated Discourse two days ago to 2.7.0beta4 and started noticing the change in custom CSS behavior. I previously had the following CSS code (simplified) to hide certain tags from users who are _ **not** _ staff:

```
:not(.staff){
    .topic-list{
        .category-marketplace{
            a[data-tag-name="wagon"]
            {
                display: none!important;
            }
        }
        
    } 
}

```

I have recently noticed the tags are also hidden from staff. I am curious if this has to do with the update. If so, how can I make the adjustment? Thank you!

---

<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:** [February 27, 2021, 2:19am UTC](https://meta.discourse.org/t/css-behavior-changed-after-software-update/181293/2 "2021-02-27T02:19:28Z")

</div>

That should still work, I tested it on my development site and it works as expected… is that the only CSS that has stopped working?

---

<div class="post-metadata">

**Author:** ![littleviolette](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@littleviolette](https://meta.discourse.org/u/littleviolette)\
**Post date:** [February 27, 2021, 2:25am UTC](https://meta.discourse.org/t/css-behavior-changed-after-software-update/181293/3 "2021-02-27T02:25:31Z")

</div>

Yes that’s the only thing I noticed that is behaving differently. Not sure why it is hiding the tags from staff since I clearly see `<body class="staff navigation-categories categories-list">` when I visit my site as a staff.

---

<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:** [March 2, 2021, 5:20am UTC](https://meta.discourse.org/t/css-behavior-changed-after-software-update/181293/4 "2021-03-02T05:20:49Z")

</div>

Did you figure this out?

---

<div class="post-metadata">

**Author:** ![littleviolette](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@littleviolette](https://meta.discourse.org/u/littleviolette)\
**Post date:** [March 3, 2021, 1:38am UTC](https://meta.discourse.org/t/css-behavior-changed-after-software-update/181293/5 "2021-03-03T01:38:57Z")

</div>

No I have not. I tried rewriting the CSS code a few ways (e.g. `html:not(.staff)` , `body:not(.staff)` , or grouping the elements within one line) but the code still hides the selected elements for staff.

---

<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:** [March 3, 2021, 2:35am UTC](https://meta.discourse.org/t/css-behavior-changed-after-software-update/181293/7 "2021-03-03T02:35:57Z")

</div>

Hmm… can you try putting this CSS at the bottom of the file containing your other CSS? I wonder if there’s a clash with some other CSS somewhere, and this could confirm it.

```css
body:not(.staff) .topic-list-item a[data-tag-name="wagon"] { 
  display: none !important; 
}

```

If you have a public site, also feel free to post the link here and I can take a closer look to see if there’s anything obvious.

---

<div class="post-metadata">

**Author:** ![littleviolette](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@littleviolette](https://meta.discourse.org/u/littleviolette)\
**Post date:** [March 4, 2021, 2:17am UTC](https://meta.discourse.org/t/css-behavior-changed-after-software-update/181293/8 "2021-03-04T02:17:11Z")

</div>

Thank you! The site is: [Marketplace - Leasehackr Forum](https://forum.leasehackr.com/c/marketplace/7)

I basically wanted certain tags within the Marketplace category and its sub-categories to be hidden from those who are not `staff`.

Thank you for looking into this!

---

<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:** [March 17, 2021, 1:25am UTC](https://meta.discourse.org/t/css-behavior-changed-after-software-update/181293/9 "2021-03-17T01:25:45Z")

</div>

Sorry for the delayed response here, did you figure out what the issue was? I do see that certain tags are hidden from non-staff when looking at your site now.

---

<div class="post-metadata">

**Author:** ![littleviolette](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@littleviolette](https://meta.discourse.org/u/littleviolette)\
**Post date:** [March 17, 2021, 4:08pm UTC](https://meta.discourse.org/t/css-behavior-changed-after-software-update/181293/10 "2021-03-17T16:08:05Z")

</div>

I haven’t worked out a solution yet. The tags are still hidden for `.staff` in addition to non-staff. Thanks!

---

<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:** [March 18, 2021, 2:34am UTC](https://meta.discourse.org/t/css-behavior-changed-after-software-update/181293/11 "2021-03-18T02:34:52Z")

</div>

I think there might be two problems here, the first being that you should add `body` before `:not`, otherwise `:not` can be any div without the class.

The second problem is that these styles are clashing with each other:

```css
:not(.staff) .topic-list .category-marketplace a[data-tag-name="wagon"] {
  display: none !important;
}

:not(.primary-group-dealers) .topic-list .category-marketplace a[data-tag-name="wagon"] {
  display: none !important;
}

:not(.primary-group-brokers) .topic-list .category-marketplace a[data-tag-name="wagon"] {
  display: none !important;
}

```

The first style will hide the wagon tag if you’re _not_ staff… but the second and third styles will hide the wagon tag if your primary group is also _not_ dealers/brokers. You’d need to be all 3 to avoid `display: none;`.

I think instead you’d want to combine the 3 like this:

```css
body:not(.staff):not(.primary-group-dealers):not(.primary-group-brokers) .topic-list .category-marketplace a[data-tag-name="wagon"] {
  display: none;
}

```

The first way, with the 3 separate styles acts as a “not and”:

_not_ `staff` _and_ `primary-group-dealers` _and_ `primary-group-brokers`

The second way, with the chained `:not` acts as an “or”:

_not_ `staff` _or_ `primary-group-dealers` _or_ `primary-group-brokers`

---

<div class="post-metadata">

**Author:** ![littleviolette](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@littleviolette](https://meta.discourse.org/u/littleviolette)\
**Post date:** [March 18, 2021, 6:38pm UTC](https://meta.discourse.org/t/css-behavior-changed-after-software-update/181293/12 "2021-03-18T18:38:44Z")

</div>

That fixes the issue! Thank you so much!
