# Customized CSS based on user role/groups

**URL:** https://meta.discourse.org/t/customized-css-based-on-user-role-groups/281766
**Category:** Development
**Tags:** css
**Created:** [October 10, 2023, 2:20pm UTC](https://meta.discourse.org/t/customized-css-based-on-user-role-groups/281766 "2023-10-10T14:20:43Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [October 10, 2023, 2:22pm UTC](https://meta.discourse.org/t/customized-css-based-on-user-role-groups/281766/2 "2023-10-10T14:22:48Z")

</div>

If you install this theme component, you can target user groups with CSS:

> [@CSS Classes for Current User's Groups](https://meta.discourse.org/t/css-classes-for-current-users-groups/226068):
>
> discourse2Summary CSS Classes for Current User’s Groups adds the groups that a member is a part of as CSS classes on the \<body\> tag.eyeglassesPreview [Preview on theme-creator.discourse.org](https://discourse.theme-creator.io/theme/Johani/user-groups-css-classes)hammer_and_wrenchRepository Link [https://github.com/discourse/discourse-groups-css-classes-in-body](https://github.com/discourse/discourse-groups-css-classes-in-body)open_bookNew to Discourse Themes? [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) Install this theme component Before: [image] After: [image] Discourse only adds the current us…

[https://github.com/discourse/discourse-groups-css-classes-in-body](https://github.com/discourse/discourse-groups-css-classes-in-body)

like this:

```scss
body.group-<your-group-name> .some-page-element-class {
    display: none;
}

```

without the component, you can also use:

```scss
.something {
  display: none;
}
.staff .something {
   display: block;
}

```

---

_[View the full topic](https://meta.discourse.org/t/customized-css-based-on-user-role-groups/281766)._
