example here: https://jsfiddle.net/gh/gist/library/pure/ad353132ce5f013c84be7c30565f8980
CSS variables are entities defined by CSS authors that contain specific values to be reused throughout a document. They are set using custom property notation (e.g.
--main-color: black;
) and are accessed using thevar()
function (e.g.,color: var(--main-color);
) .https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables
You can change the progress bar percentage changing the --percentage
variable directly on the style
attribute.
The background-color
will change accordingly from green
to red
.