I am trying to add color to another element with the data attribute in my css, but doensn't work ...
I follow these instructions:
Attr () function: property values collected from the document being edited.
W3c
HTML
<table> <tr> <td> <span class="bgborder" data-color="#e7663f"></span> <i class="fa fa-copy"></i> </td> <td> <span>Blaablaaablaaa</span> </td> </tr> </table> <table> <tr> <td> <span class="bgborder" data-color="#77c385"></span> <i class="fa fa-upload fa-fw"></i> </td> <td> <span>Blablaablaaa</span> </td> </tr> </table>
CSS
.bgborder { display: block; width: 5px; height: 100%; position: absolute; top: 0; background-color: attr(data-color color); }
Can’t see anything ... Am I right?
My chrome inspector I have this:
background-color: attr(data-color color); /!\ Invalid property value
I do not understand why...???
Thank you for your help:)
source share