Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<div></div>
  
</body>
</html>
 
const div = document.querySelector('div');
div.attachShadow({mode:'open'});
const style = document.createElement('style');
style.textContent = `
  @import url(https://fonts.googleapis.com/css2?family=Mountains+of+Christmas);
  h1 {
    font-family: Mountains of Christmas;
  }
`;
div.shadowRoot.appendChild(style);
const h1 = document.createElement('h1');
h1.textContent = 'Hello world';
div.shadowRoot.appendChild(h1);
Output

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

Dismiss x
public
Bin info
tomasdevpro
0viewers