<meta HTTP - equiv="content-type" Content="text/HTML. Charset=gb2312 "/& gt;
<style>
# app {margin: 100 px; }
The shadow - child {
color: red;
}
</style>
<body>
//1. Get shadow shadow host host
Var shadowHost=document. QuerySelector (' shadow - CLS ');
//2. Create a shadow shadow root
Var shadowRoot=shadowHost. CreateShadowRoot ();
//3. Shadow root as shadow first node of the tree, the other nodes, such as the following p nodes are its child nodes,
ShadowRoot. InnerHTML='& lt; P & gt; I am a child node & lt;/p> ';
</script>