The Document.styleSheets read-only property returns a StyleSheetList of CSSStyleSheet objects for stylesheets explicitly linked into or embedded in a document.
var styleSheetList = document.styleSheets;
The returned object is a StyleSheetList.
It is an ordered collection of CSSStyleSheet objects. styleSheetList.item(index) or simply styleSheetList[index] returns a single stylesheet object by its index (index is 0-based).
The list is ordered as follows:
Link headers are placed first, sorted in header order.| Specification | Status | Comment |
|---|---|---|
| CSS Object Model (CSSOM) The definition of 'styleSheets' in that specification. | Working Draft | |
| Document Object Model (DOM) Level 2 Style Specification The definition of 'styleSheets' in that specification. | Obsolete | Initial definition |
| Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
| Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|---|
| Basic support | ? | ? | (Yes) | (Yes) | ? | ? | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/document/styleSheets