Is it possible to add some data attributes to a <figure>
element and then access them from CSS?
For instance, I've tried
figure { margin: 0 attr(data-margin %); }
with
<figure data-margin="15">...</figure>
but it doesn't work.
Is there another way without using JS?
EDIT: I don't think my question is a duplicate. In fact, I'm looking for an alternative way to do this.
My goal is to decorate some elements in a page with attributes that then the end user can access and make use of by writing some CSS code. If that's impossible, I'll just ask them to write JS code, but that would be less safe, I think.
(The end users are ML researchers. I'm sure they can handle some CSS or JS code.)