Skip to content

Instantly share code, notes, and snippets.

@FiNGAHOLiC
Created August 12, 2011 07:24
Show Gist options
  • Save FiNGAHOLiC/1141638 to your computer and use it in GitHub Desktop.
Save FiNGAHOLiC/1141638 to your computer and use it in GitHub Desktop.
Dynamic CSS
var style, css;
if (document.createStyleSheet){ // IE
style = document.createStyleSheet();
css = function(s){
style.cssText = s;
}
} else {
style = document.createElement('style');
document.getElementsByTagName('head')[0].appendChild(style);
css = function(s){
style.textContent = s;
}
}
/*
var s = +new Date;
css('*{color:red;}');
var t = new Date - s;
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment