get the css of any element using dumpCSSText
1:56 am, April 27, 2018
this should get the styles of any element, cant seem to get it working.
via here: https://stackoverflow.com/questions/5296622/how-can-i-grab-all-css-styles-of-on-element
Using Javascript worked best for me. Here's how I did it:
Open Chrome DevTools console.
Paste this dumpCSSText function from this stack overflow answer into the console, and hit Enter:
function dumpCSSText(element){
var s = '';
var o = getComputedStyle(element);
for(var i = 0; i < o.length; i++){
s+=o[i] + ':' + o.getPropertyValue(o[i])+';';
}
return s;
}
When using Chrome, you can inspect an element and access it in the console with the $0 variable. Chrome also has a copy command, so use this command to copy ALL the css of the inspected element:
copy(dumpCSSText($0));
Paste your CSS wherever you like! 🎉
Code
html
css
js
scripts