Conditional formatting of HTML+CSS?

0 like 0 dislike
9 views
Is there a way to do conditional formatting like in Excel. I.e. to the properties of an element depended on its content. Preferably without JS.
For example, the color numbers hung from its value.
Well, let's say
0 white
1 red
2 green and so on
by | 9 views

1 Answer

0 like 0 dislike
https://jsfiddle.net/9aqchcsf/1/
\r\r

[data-number]::before { content: attr(data-number); } [data-number="1"] { color: red; } [data-number="2"] { color: blue; } [data-number="3"] { color: green; }
by
110,608 questions
257,186 answers
0 comments
33,863 users