Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta name="description" content=":host styling" />
<meta charset=utf-8 />
<title>JS Bin</title>
<style>
  .contentClass {
    color: blue;
  }
</style>
</head>
<body class="bodyClass">
  
  <template id="tmpl">
    <style>
      ::content > * {
        color: red;
      }
    </style>
    <content></content>
  </template>
  
  <div id="host" class="hostClass">
    <div class="contentClass">
      content
    </div>
  </div>
  
  <script>
    document.addEventListener('DOMContentLoaded', function() {
      var host = document.querySelector('#host');
      var root = host.createShadowRoot();
      var template = document.querySelector('#tmpl');
      root.appendChild(template.content);
    });
  </script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
morethanrealpro
0viewers