I’m sure the information already exists, but I couldn’t find it; sorry :-/
I want to create CSS rules using JavaScript, and apply them to the whole page, as if they were in a style element in the document’s head. I don’t want to do it by generating the CSS text – I want to keep the rules as entities (JavaScript variables) that I can change, thus changing the appearance of the page later on.
Any help will be most appreciated!
I’ve found what I wanted: http://www.javascriptkit.com/dhtmltutors/externalcss3.shtml .
(Thanks to all who’ve answered and commented. What I wanted – and finally found, see the link above – was an actual CSS-rule object that I could work with dynamically, like with HTML elements. While some of the answers came close, none of them was exactly it.)