--- url: "https://web.dev/articles/css-module-scripts" titulek: "Using CSS Module Scripts to import stylesheets | Articles | web.dev" h1: "Using CSS Module Scripts to import stylesheets Stay organized with collections Save and categorize content based on your preferences." popis: "Learn how to use CSS module scripts to import CSS stylesheets using the same syntax as JavaScript modules." jazyk: "en" kanonicka: "https://web.dev/articles/css-module-scripts" drobecky: ["Articles", "Using CSS Module Scripts to import stylesheets"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 02:41:59" znaku: 4765 slov: 611 kodovani: "iso-8859-2" sha256: "2f1cbdb2bc0f6208666842a95b18e926d1d6c3bda538bf5ae01bd15e372d389c" --- Using CSS Module Scripts to import stylesheets Stay organized with collections Save and categorize content based on your preferences. Learn how to use CSS module scripts to import CSS stylesheets using the same syntax as JavaScript modules. Dan Clark With the new CSS module scripts feature, you can load CSS style sheets with `import` statements, just like [JavaScript modules](https://developer.mozilla.org/docs/Web/JavaScript/Guide/Modules). The style sheets can then be applied to documents or [shadow roots](https://developer.mozilla.org/docs/Web/API/ShadowRoot) in the same manner as [constructable stylesheets](/articles/constructable-stylesheets). This can be more convenient and [more performant](https://dandclark.github.io/json-css-module-notes/#css-module-performancememory-examples) than other ways of importing and applying CSS. Browser Support CSS module scripts are available by default in Chrome and Edge in version 93. Support in Firefox and Safari is not yet available. Implementation progress can be tracked at the [Gecko bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1720570) and [WebKit bug](https://bugs.webkit.org/show_bug.cgi?id=227967), respectively. Prerequisites Familiarity with [JavaScript modules](https://developer.mozilla.org/docs/Web/JavaScript/Guide/Modules). Familiarity with [constructable stylesheets](/articles/constructable-stylesheets). Using CSS module scripts Import a CSS module script and apply it to a document or a shadow root like this: `import sheet from './styles.css' assert { type: 'css' }; document.adoptedStyleSheets = [sheet]; shadowRoot.adoptedStyleSheets = [sheet];` The default export of a CSS module script is a [constructable stylesheet](/articles/constructable-stylesheets) whose contents are those of the imported file. Like any other constructable stylesheet, it is applied to documents or shadow roots using [`adoptedStyleSheets`](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets). Unlike other ways of applying CSS from JavaScript, there is no need to create `