# إضافة معرف (ID) أو فئة (CLASS) إلى صورة (ضمن منشور)

**URL:** <https://meta.discourse.org/t/add-an-id-or-class-to-an-image-within-a-post/114740>\
**Category:** Product Support\
**Created:** [11 أبريل 2019، 9:22ص 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:** 2

<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 أبريل 2019، 9:32ص UTC](https://meta.discourse.org/t/add-an-id-or-class-to-an-image-within-a-post/114740/2 "2019-04-11T09:32:41Z")

</div>

You can’t by default. There’s only a few attributes that are whitelisted for `<img>` tags. You can find those here:

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

Whitelisting specific classes can be done but would require a plugin.

How often do you plan on using this? You might be able to make something work with a theme component but the implementation will depend on your use case. Can you share a specific example of what you’re trying to do?

for example, you can wrap the image in something like

```plaintext
<div data-theme-banners>
  <img src='foo'>
</div>

```

then you can use the selector

```plaintext
[data-theme-banners] img

```

---

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