我們的志工尚未將本文翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!
您也可以閱讀本文的 English (US) 版本。

The styleSheetSets read-only property returns a live list of all of the currently-available style sheet sets.

Syntax

var sets = document.styleSheetSets;

On return, sets is a list of style sheet sets that are available.

Example

Given an <ul> (list) element with the ID "sheetList", you can populate it with the names of all the available style sheet sets with code like this:

let list = document.getElementById('sheetList');
let sheets = document.styleSheetSets;

list.innerHTML = '';

for (let i = 0; i < sheets.length; i++) {
  let item = document.createElement('li');

  item.innerHTML = sheets[i];
  list.appendChild(item);
}

Notes

The list of available style sheet sets is constructed by enumerating all the style sheets available for the document, in the order in which they're listed in the document.styleSheets attribute, adding the title of each style sheet that has a title to the list. Duplicates are dropped from the list (using a case-sensitive comparison).

Specifications

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome No support NoEdge ? Firefox Full support YesIE ? Opera ? Safari ? WebView Android No support NoChrome Android No support NoEdge Mobile ? Firefox Android Full support YesOpera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

See also

文件標籤與貢獻者

最近更新: mfuji09,