Pen Settings



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


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


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.


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.


                 <div id="demo-modal" class="modal" role="dialog" tabindex="-1">
      <div class="model-inner">
        <div class="modal-header">
          <h3>Hello World</h3>
          <button class="modal-close" data-id="demo-modal" aria-label="Close">
          Natus earum velit ab nobis eos. Sed et exercitationem voluptatum omnis
          dolor voluptates. Velit ut ipsam sunt ipsam nostrum. Maiores officia
          accusamus qui sapiente. Dolor qui vel placeat dolor nesciunt quo dolor
          dolores. Quo accusamus hic atque nisi minima.
    <button class="modal-open" data-id="demo-modal">Display Modal</button>


                body {
  font-family: sans-serif;
.modal {
  display: none;
  align-items: center;
  justify-content: center;
  position: fixed;
  z-index: 1;
  width: 100%;
  height: 100%;
.modal[open] {
  display: flex;
.model-inner {
  background-color: white;
  border-radius: 0.5em;
  max-width: 600px;
  padding: 2em;
  margin: auto;
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid black;
#modal-overlay {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
  background-color: black;
  opacity: 0.5;  


                let modal;
document.addEventListener("click", (e) => {
  if ( === "modal-open") {
    modal = document.getElementById(;
  } else if ( === "modal-close") {
  } else {

const openModal = (modal) => { = "hidden";
  modal.setAttribute("open", "true");
  document.addEventListener("keydown", escClose);
  let overlay = document.createElement("div"); = "modal-overlay";

const closeModal = (modal) => { = "auto";
  document.removeEventListener("keydown", escClose);

const escClose = (e) => {
  if (e.keyCode == 27) {