Scoped style sheets as a web component.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
src
test
.gitignore
package.json
readme.md
yarn.lock

readme.md

Scoped Style Sheets

Scoped style sheets (style element that only apply to elements inside the same parent element) as a web component.

Usage:

<script src="scoped-style.js"></script>
<div>
  <p>I'm red</p>
  <style type="text/css" is="scoped-style">
    p {
      color: red;
    }
  </style>
</div>
<p>I'm not red</p>

No dependencies. Works with @media rules. Half-heartedly tested in chrome and firefox. Could conceivably work in other browsers when web component polyfills are in place.