DEV Community 👩‍💻👨‍💻

Discussion on: Set CSS styles with javascript

yellow1912 profile image

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.