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:
function injectCSS(rule) { $("head").append('<style>' + rule + '</style>') } // example injectCSS("div { padding:5px }")