Search code examples
javascripthtmlcssstylesheet

How to display a Web Page's Stylesheet


Is there any way to display the FULL CSS stylesheet of a web page, other than fetching every style for each element like this:

document.write("width:"+document.getElementById("to").style.width+";");

The CSS can be in an external file, or inside <style> tag.


Solution

  • You can use document.styleSheets

    like in document.styleSheets[0].cssRules[0].cssText