Mozilla created a function that permits to inject some CSS into the document: addStylesheetRules()
But if you use jQuery you may want to use this function:
1 2 3 4 5 6 | function injectCSS(rule) { $( "head" ).append( '<style>' + rule + '</style>' ) } // example injectCSS( "div { padding:5px }" ) |