Last active
August 29, 2015 14:19
-
-
Save domenic/56da9586bb1326a05edb to your computer and use it in GitHub Desktop.
Styling shadow DOM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<style> | |
#label { | |
background: var(--nametag-background); | |
} | |
#name { | |
@extend %nametag-name; | |
} | |
</style> | |
<p id="label">Hello my name is</p> | |
<p id="name"><content select="name"></content></p> | |
</template> | |
<!-- assume we also set up a <name-tag> custom element using this template --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
name-tag#foo %nametag-name { | |
color: blue; | |
opacity: 0.5; | |
} | |
name-tag#foo { | |
--nametag-background: linear-gradient(green, blue); | |
} | |
</style> | |
<p>Here's a name tag:</p> | |
<name-tag id="foo"><name>Domenic</name></name-tag> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment