Styling based on group membership

(Kane York) #1

I think it would be pretty cool if we could get some CSS classes on posts based on what groups a user belongs to.

So, for example:

<article class="boxed group-trust-level-2 group-bb-writers" ......>

With a checkbox for whether or not the group shows up in the styling, in case we want private groups for some reason.

It would already be possible to do crazy CSS stuff with matching on article[data-user-id=6626], but that would be very annoying to do for every user in the group.

(Jeff Atwood) #2

For what purpose? Can you provide a visual mockup? Not clear what this would do, or be for.

(Kane York) #3

Say, something like this:

Which would be given with div.topic-body {
    background-color: rgb(202, 233, 207);

The existing per-user customization, the highlighted name and title, might not be enough for some people:

(that subreddit is a little bit, ah, crazy with its CSS customizations…)

div.usertext-body *:first-child::first-letter {
  text-transform: lowercase;
  text-decoration: underline;

(rafalp) #4

How about live site example, if I may? :wink: Blizzard uses extra styling to visually differ their employees posts and MVP’s from user ones:

(Jeff Atwood) #5

Right, we already have that in two forms – look at my post, and look at close / open / archive messages.

(Kane York) #6

I’m not actually that experienced with CSS - is there actually a selector that would allow a forum to do that (set a background-image on the post) for everyone with a title?