I’ve wanted attr() to be more widely accepted in CSS values since, well, I can’t remember. A long time. I want to be able to do something like:
p[data-size] {width: attr(data-width, rem);}
I realize adding this would probably lead to someone creating a framework […] where all the styling is jammed into a million data-*attributes […], but we shouldn’t let that stop us.
Is it too late to vote for this? I’d love to be able to do this for background images. Relying on JavaScript to get the URL from the attribute and style the element is such a hack.
Via: Jim Nielsen