Skip to content

Instantly share code, notes, and snippets.

@OlivierPerceboisGarve
Forked from cowboy/dump-cssRules.js
Created July 7, 2010 13:43
Show Gist options
  • Save OlivierPerceboisGarve/466709 to your computer and use it in GitHub Desktop.
Save OlivierPerceboisGarve/466709 to your computer and use it in GitHub Desktop.
// Dump all document.styleSheets[*].cssRules[*].cssText to a div (easier to copy and paste):
(function(s,c,r,i,j){
var out = '';
for(i=0;i<s.length;i++){
c=s[i].cssRules;
for(j=0;j<c.length;j++){
r=c[j].cssText;
//console.log('document.styleSheets['+i+'].cssRules['+j+'].cssText = "'+r+'";')
out+= r+'<br>';
}
}
var div = document.createElement('div');
div.innerHTML = out;
div.style.cssText = "background-color: white; position: absolute; top: 0; z-index:1000001";
document.getElementsByTagName('body')[0].appendChild(div);
})(document.styleSheets);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment