I have a span class cor
(color):
<span class="cor" data-c="red">red</span>
<span class="cor" data-c="green">green</span>
<span class="cor" data-c="blue">blue</span>
and cor style:
.cor{
padding:5px;
margin:5px;
}
What I want is the .cor background-color
to be the color of the data-c
element value. Can I style the .cor background based on the data-c
value?
edit-------
it is not working:
background-color: attr(data-c);