I want to use multiple data attribute in single css. So is that possible.?
I had created css given blow, i want to use data-letters and data-color both in css but it is not working.
data-color will placed at background and data-letters will placed at content in css
body { font-family: sans-serif; }
[data-letters]:before {
content: attr(data-letters);
display: inline-block;
font-size: 32px;
width: 85px;
height: 80px;
line-height: 2.5em;
text-align: center;
border-radius: 50%;
background: #95A73B;
vertical-align: middle;
margin-right: 1em;
color: white;
margin-top: 20px;
}
<p data-letters="PB" data-color="#c0227a"></p>
css[data-letters]ascss[data-letters]="PB"?attr()for anything other than thecontentproperty of pseudo elements right now, I think. If you want to set colors etc. dynamically, then you should look into CSS variables (can be set via inline styles.)