Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
function addCSS (css){
if (document.createStyleSheet) { // for IE
var sheet = document.createStyleSheet();
sheet.cssText = css;
return sheet;
} else {
var sheet = document.createElement('style');
sheet.type = 'text/css';
var _root = document.getElementsByTagName('head')[0] || document.documentElement;
sheet.textContent = css;
return _root.appendChild(sheet).sheet;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment