DEV Community

Discussion on: Set CSS styles with javascript

Collapse
 
yellow1912 profile image
yellow1912

With CSSStyleSheet, what is the best way to replace a rule? I see insertRule seems to take an index, if I re-use that same index then that rule will be replaced? The reason is that I want to allow the endusers to change some styles via a UI, then quickly update that to the specific element.