# Following on from Adding Unique Class Names

**URL:** <https://meta.discourse.org/t/following-on-from-adding-unique-class-names/37881>\
**Category:** Feature\
**Created:** [January 13, 2016, 11:18am UTC](https://meta.discourse.org/t/following-on-from-adding-unique-class-names/37881 "2016-01-13T11:18:10Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![ccdw](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ccdw/32/51564_2.png) [@ccdw](https://meta.discourse.org/u/ccdw)\
**Post date:** [January 14, 2016, 4:41pm UTC](https://meta.discourse.org/t/following-on-from-adding-unique-class-names/37881/5 "2016-01-14T16:41:08Z")

</div>

> [@Mittineague](#):
>
> In my limited experience with styling Discourse, I have found that by using a combination of id, class and relationship selectors I have been able to target what I wanted to style with success.

Yes - although the ability to add a class to unrelated elements and then select them by a single selector is key here.

> [@Mittineague](#):
>
> This is not to say that Discourse doesn’t have any elements that can’t be specifically targeted. Just that I have found any yet. Nor is it to say that adding ids or class values to the elements that others more commonly want to target couldn’t be beneficial.

I seem to recall there’s a few orphans which rely on nth selectors and things like that which is obviously not a good thing when the DOM is provided by SAAS.

I’d also like to see the ability to add classes to posts as currently I have to add a tag to select a post, unless I use the ID - which is cumbersome. So instead I use a jQuery selector to find posts with a target tag that also have images in a Lightbox - this then allows me to insert a gallery control at run time. For example:

> `'#main-outlet:has(#topic-title a[class*="tag-carousel"]) div[data-post-number="1"] article .topic-body div.cooked:has(.lightbox-wrapper):not(.carousel-enabled)';`

Discourse is great and in my view has so much potential on the front end - it’s almost limitless.

> [@Mittineague](#):
>
> As for Trust Level CSS, AFAIK the HTML sent to the browser does vary depending on whether or not the visitor has JavaScript enabled and whether or not they are logged in. But not by their Trust Level. For that some JavaScript magic would be needed.

Edit: Yes, that’s what I gathered by looking at the DOM. I am hoping it’s not too much work on the back end to add another check when the permissions are applied. Btw, this is not a major requirement (which I should have said first time round). It’s just another tool in CSOM toolkit.

PS, thanks for your help.

---

_[View the full topic](https://meta.discourse.org/t/following-on-from-adding-unique-class-names/37881)._
