In essence what I'm trying to do is create a CSS style that can use the values of custom tag attributes as their values. I've read about the "attr()" function and it seems to work only in the content property of :before/:after selectors. Basically I'd like to do something like the following:
HTML
<span fgprop="#ff0000">Some Text</span>
<span fgprop="#00ff00">Other</span>
CSS
span {
color : attr(fgprop);
}
The alternative to accomplish this, which I'm using now,is to use jQuery css() to set the color on each span with its fgprop attr value, but that seems very clunky since this approach won't automatically react to changes in the fgprop property. CSS seems the best place for this as its a presentation only level transformation.
Is there a way to do this? (Right now I'm only targeting webkit, so some kind of -webkit- specific extension would work for my use case, if that matters). Thanks in advance!
attr(fgprop, color)?data-.