# Images with Link adding classes

**URL:** <https://forum.bricksbuilder.io/t/images-with-link-adding-classes/40749>\
**Category:** Uncategorized\
**Created:** [November 2, 2026, 2:01pm UTC](https://forum.bricksbuilder.io/t/images-with-link-adding-classes/40749 "2026-11-02T14:01:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerie](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/g/958977/32.png) [@gerie](https://forum.bricksbuilder.io/u/gerie)\
**Post date:** [November 2, 2026, 2:01pm UTC](https://forum.bricksbuilder.io/t/images-with-link-adding-classes/40749/1 "2026-11-02T14:01:47Z")

</div>

Hi,  
I have a question about classes on images with a Link:

Let’s say I Insert a svg and add a class directly to that svg. Then I add a link to the svg. The output is as expected:

- The class is added directly to the svg.

Now, if I add a image (i.e. a png file) and give that img the same class it is added to the img tag itself as expected. But if I add a link to that image, that class is moved to the a tag.

So If I want to have that same class on the img-tag I have to insert it as an attribute, because I want to style the img with that class not the link.

What’s the logic behind that behavior?

Thanks

---

<div class="post-metadata">

**Author:** ![UserfreundSuat](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/userfreundsuat/32/34362_2.png) [@UserfreundSuat](https://forum.bricksbuilder.io/u/UserfreundSuat)\
**Post date:** [November 2, 2026, 2:45pm UTC](https://forum.bricksbuilder.io/t/images-with-link-adding-classes/40749/2 "2026-11-02T14:45:44Z")

</div>

Hi,

Since bricks has to wrap the `<img>`-Tag to be able to use it as a link, it needs to choose the place for your class and they always choose the root of an element for consistency.

If you dislike that behaviour use a Image-Element inside a Div-Element, which you use as a link.

If you don’t like that the structure is nested, put both inside a Component et voilà, you got yourself the desired behaviour / structure.

Best Regards  
Suat
