# Aggiungi un ID o una CLASS a un'immagine (all'interno di un post)

**URL:** https://meta.discourse.org/t/add-an-id-or-class-to-an-image-within-a-post/114740
**Category:** Support
**Created:** [11 Aprile 2019, 9:22am UTC](https://meta.discourse.org/t/add-an-id-or-class-to-an-image-within-a-post/114740 "2019-04-11T09:22:53Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [11 Aprile 2019, 10:58am UTC](https://meta.discourse.org/t/add-an-id-or-class-to-an-image-within-a-post/114740/4 "2019-04-11T10:58:08Z")

</div>

> [@DigitalStartup](#):
>
> it looks like the ID is being stripped out my DIV as well.

Correct, `<div>` tags also have very specific properties that are whitelisted. Those can be found here:

[https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/white-lister.js.es6#L141-L152](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/white-lister.js.es6#L141-L152)

That file - it is the same one from my earlier post - contains all the whitelisted markup allowed in the composer so have a look around to see what is allowed. Anything not on that list will be stripped out to prevent abuse.

> [@DigitalStartup](#):
>
> I just don’t want it to appear to logged in users

The `<html>` tag has a CSS class added to it to when the user is not logged in. That class is `anon`. You can use that class to selectively show the banners. So something like this in your post:

```plaintext
<div data-theme-banners>
  <a href="#">
    <img src="foo">
  </a> 
</div>

```

and this in your theme

```plaintext
html:not(.anon) .cooked [data-theme-banners] {
  display: none;
}

```

and that would ensure that the element is only visible to users who are not logged in.

---

_[View the full topic](https://meta.discourse.org/t/add-an-id-or-class-to-an-image-within-a-post/114740)._
