Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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.


Save Automatically?

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.


                <p><a href="#modal-message">Create a new message</a></p>

<div id="modal-message" class="modal">
  <div class="modal__window">
    <h2 class="modal__title">New Message</h2>
    <form action="">
        <label for="test">Label</label>
        <input type="text" id="test">
  <a class="modal__closer" href="#">Close</a>


                body {
  padding: 1em;

.modal {
  background: rgba( 0, 0, 0, .5 );
  /* Internet Explorer 10 */
  display: -ms-flexbox;
  -ms-flex-pack: center;
  -ms-flex-align: center;
  /* Firefox */
  display: -moz-box;
  -moz-box-pack: center;
  -moz-box-align: center;
  /* Safari, Opera, and Chrome */
  display: -webkit-box;
  -webkit-box-pack: center;
  -webkit-box-align: center;
  /* W3C */
  display: box;
  box-pack: center;
  box-align: center;

  position: absolute;
  top: 0;
  left: 100%;
  right: 0;
  bottom: 0;
  // transition
     -moz-transition: opacity .25s linear, left 0 .25s;
      -ms-transition: opacity .25s linear, left 0 .25s;
  -webkit-transition: opacity .25s linear, left 0 .25s;
          transition: opacity .25s linear, left 0 .25s;
  // hide by default
  left: 100%;
  //display: none;
  opacity: 0.0001;
// show when targeted
.modal:target {
  left: 0;
  opacity: 1;

  // transition
     -moz-transition: opacity .25s linear;
      -ms-transition: opacity .25s linear;
  -webkit-transition: opacity .25s linear;
          transition: opacity .25s linear;

// focus carat will be on the window
.modal:focus {
  outline-width: 0;
.modal__window {
  background: #fff;
  border: 1px solid;
  box-shadow: 1px 1px 1px #000;
  padding: 20px;
  width: 200px;
  // make sure this sits above the closer
  position: relative;
  z-index: 1;
// apply focus
.modal:focus .modal__window {
  outline-color: #5B9DD9;
  outline-offset: 0px;
  outline-style: auto;
  outline-width: 5px;        
.modal__title {
  background: #ebebeb;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: -20px -20px 10px;
  padding: 10px 20px;
  border-bottom: 1px solid;
.modal__closer {
  // hide the text
  white-space: nowrap;
  overflow: hidden;
  text-indent: 100%;
  // cover the skrim
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;


  function assignCloserTarget()
      var target = document.querySelector(
            this.href.replace( re_hash, '$1' )
          closer = target.querySelector('.modal__closer');
      // Add the event listener if we have not touched the node before
      if ( closer.returnTo == undefined )
          closer.addEventListener( 'click', returnToLink );
      closer.returnTo = this;
  function returnToLink( e )
      if ( this.returnTo != undefined )

  var forEach = Array.prototype.forEach,
      modal_links = document.querySelectorAll('a[href^="#modal"]'),
      modals = document.querySelectorAll('.modal'),
      re_hash = /^.*?(#.*)$/; modal_links, function( link ){
      link.addEventListener( 'click', assignCloserTarget );
  }); modals, function( modal ){