Ok, so I have this CSS code that changes the color according to the monetary value:
td[data-monetary-amount]:after,
td[data-monetary-amount^="+"] {
content: attr(data-monetary-amount);
color: green;
}
td[data-monetary-amount^="-"]:after {
color: red;
}
and HTML:
<table border="1">
<tr>
<td data-monetary-amount="+23"></td>
</tr>
<tr>
<td data-monetary-amount="-20"></td>
</tr>
</table>
The above code works great.
What I want to do is to add text characters: ↑ and ↓ according to the + and -.
These characters should be added in front of "+" "-".
So the output should be:
↑+23
↓-20
I have tried:
td[data-monetary-amount]:after,
td[data-monetary-amount^=" (+"],
td[data-monetary-amount^="+"] {
content: attr(data-monetary-amount);
color: green;
content: "↑";
}
But it didn't work.
I know I'm making a mistake somewhere.
Need help.