Can we enhance a <figure>
element by adding data attributes and then utilizing them in CSS?
For example, I attempted
figure { margin: 0 attr(data-margin %); }
using
<figure data-margin="15">...</figure>
but it didn't yield the desired results.
Is there an alternative method that doesn't involve JavaScript?
UPDATE: I don't believe my inquiry is a duplicate. I am seeking a different approach to achieve this.
I intend to customize certain elements on a page with attributes that end users can access and leverage through CSS coding. If this is not feasible, I may have to advise them to resort to JS scripting, albeit less secure.
(The end users are ML researchers. They are proficient in CSS and JS coding.)