Skip to content

Instantly share code, notes, and snippets.

@CezaryDanielNowak
Created November 11, 2014 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CezaryDanielNowak/715ab3e7f1e6f4e055a5 to your computer and use it in GitHub Desktop.
Save CezaryDanielNowak/715ab3e7f1e6f4e055a5 to your computer and use it in GitHub Desktop.
function addCSSRule(sheet, selector, rules, index) {
if(sheet.insertRule) {
sheet.insertRule(selector + "{" + rules + "}", index);
}
else {
sheet.addRule(selector, rules, index);
}
}
// Use it!
addCSSRule(document.styleSheets[0], "header", "float: left");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment