Images with Link adding classes

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

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