Finding CSS selectors for page layout, user groups

AI-generated summary

In a discussion about finding CSS selectors for page layout and user groups, stephtara inquires if specific rules can be applied based on user groups or trust levels. ToddZ initially suggests using browser inspection tools and lists several default selectors like is-staff and is-admin. He also references a component that adds <body> tag classes for user groups, such as group-trust_level_0. Moin asks if these group classes appear by default, prompting ToddZ to clarify that the specific component is required. stephtara expresses excitement about the possibilities, despite the work involved. The thread briefly covers a confusion regarding stephtara being assigned as the topic owner, which ToddZ admits was an error during an attempt to edit the post, though stephtara remains understanding.

Continuing the discussion from Discourse Doc Categories:

:information_source: Below is an answer added to OP before making Steph the topic owner. – @ToddZ


I don’t know if there’s an overall reference, but the browser’s Inspect tool can help dig them up: Making custom CSS changes on your site: Finding the right CSS selectors

Some selectors are listed in A little help with a CSS selector?:

  • is-staff
  • is-admin
  • is-moderator
  • is-new-user
  • group--primary_group_name

And the CSS Classes for Current User's Groups component gives the <body> tag classes for the logged-in user that you could target, like:

class="chat-enabled group-trust_level_0 group-trust_level_1 group-trust_level_2 group-trust_level_3" ... etc.

Does this happen by default now? I thought you need to install CSS Classes for Current User's Groups for that.

oh wow, this looks like it’s going to allow me to do a bunch of things I’m thinking of (even if it’s going to require quite a little work on my side… at least it’s possible!!)

Whoops, yes, appears you need the component. Editing the post.

I’m a bit confused, why am I suddenly the topic owner of something I didn’t write?

I goofed, Steph. I really should have moved the subject a different way, and in trying to fix it I made things more confusing. I’ll see if we can revert that.

Ah, no worries! Will go back to catch my last hour of sleep while you try and shuffle things around!