Sometimes we need an easy way to dynamically add new rules. For example, we can generate selectors on the fly, but property values as well.
Unfortunately, it doesn't seem so easy to do in a cross-browser way. That's why this library was born.
Just call cssrule.add(rule)
. rule
must be a string with a valid
CSS rule, which means selector, properties and values.
var myColor = "#2565ab";
cssrule.add("div { border-color: " + myColor + "}");
You can see some live examples on cssrule.js' simple website.