Forum How do I...?

Craft image path base on its attribute

luizbgomide
If I have;
<div class="hasImage" name="something"></div>

And I want to add an image previous to it using:
div.hasImage::before { content: url("images/something.jpg") }

How can I craft the path "images/something.jpg", using just "something".

I've seem many old posts mentioning dynamic path and something like what I need, but they are very old, by now I hope that something have changed and it is now possible... :/

Edited by luizbgomide

mikeday
I think you will need to use JavaScript for this.
hallvord
Indeed - you're not the only one who would like this feature, but it is simply not supported in CSS. However, it is fairly trivial to do with a little bit of JavaScript.

Announcement: repos for tests/utils