Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <dialog>
  <h1>
    Hello world from the dialog
  </h1>
  <div>
    <button class="close">
      Dialog 닫기
    </button>
  </div>
</dialog>

<div>
  <p>
    <i>dialog.showModal()</i> 누르면 고정된 모달 dialog가 열리고 ESC를 누르면 닫히고 다른 모든 요소에 액세스할 수 없게 된다.

  </p>
  <button class="open">
    Dialog 열기
  </butto>
</div>

              
            
!

CSS

              
                
body {
 height: 10em;
}

div {
  display: flex;
  flex-direction: column;
  align-items: center;
}

dialog {
  top: 100px;
}

p {
  text-align: center;
}

button {
  width: 100px;
  height: 30px;
}
              
            
!

JS

              
                const dialog = document.querySelector('dialog');

dialog.addEventListener('click', (event) => {
  if (event.target.nodeName === 'DIALOG') {
    dialog.close();
  }
});

const openButton = document.querySelector('button.open')

openButton.addEventListener('click', () => {
  dialog.showModal();
})

const closeButton = document.querySelector('button.close')

closeButton.addEventListener('click', () => {
  dialog.close();
})


              
            
!
999px

Console