Reputation: 115
Here I want html entities in colors. As the default color is black, I want them to be in specific color without css styling. Is that possible....
.error_number {
color: #F00;
}
<span class="error_number">✔</span>
Thanks in advance..
Upvotes: 8
Views: 10425
Reputation: 11
Only way is to use css "filter" property.
// this converts black to green
filter: invert(26%) sepia(76%) saturate(1788%) hue-rotate(95deg) brightness(92%) contrast(101%);
Here's a codepen I found to calculate filter for target colour.
Upvotes: 1
Reputation: 943108
No. HTML entities represent characters. Characters (except for emoji) do not have inherent colour.
Upvotes: 16
Reputation: 94
Use the in-line style
option:
<span class="error_number" style="color:f00;">✔</span>
CSS can easily be implemented inline with the style
element. Though, it isn't recommended for larger jobs.
Upvotes: 0
Reputation: 25
Try this: This should work.
<span style="color:F00;" class="error_number">✔</span>
Since you don't want to change the color in the style tags.
Upvotes: 0