Sound simple enough.
I Just want to set some --progress
variable on DOM element and read it through some attribute on that element:before
.
Setting CSS-variable on the element is just element.style.setProperty('--progress',value)
. But it turns out that the value is not inherited to pseudo-element. even if declared with :
@property --progress{
syntax: '<number>';
inherits: true;
initial-value: 0;
}
so how can I do that without declare CSS class
for each percent like :
element.p-1:before{
--progress:1%;
}
element.p-2:before{
--progress:2%;
}
....