Sign in


Inserts a style rule into the page's stylesheet. The rule will apply to all current and future elements that match the selector.


neon.styleRule(string selector, string rules)


The CSS selector for the rule. This may include multiple selectors separated by commas.


The value of the rule. This string may contain multiple rules of the format "property:value", separated by semicolons. It should not include an opening "{" or closing "}".

Return value

This method is chainable. It returns a copy of the Neon object on which it was called.


This method adds a style rule to the current page's stylesheet. The style rule will apply to all current and future elements matching the selector specified in selector, and can even match if the element's classnames change. It supports pseudo-classes such as ":focus".

It is preferable to use this instead of inline styles in many situations, since rules that are set in a stylesheet may be overridden by user stylesheets on the page.

However, these rules cannot be un-set once they are set, nor can they be animated. It is inefficient to set the same style multiple times, because all instances will continue to be remembered and calculated by the browser. Certain browsers such as Internet Explorer may also limit the number of style rules in a stylesheet, although at least one thousand rules should be supported without problems.

The document must have a <head> element at the time this is called.


// Set some style rules for the current page.
neon.styleRule("#mymenu ul, #mymenu ol", "margin-left:6px; padding: 0");