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

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.

HTML

              
                <p><a id="popup" class="popup-btn" href="javascript:void(0);">Open window 1</a></p>
<p><a id="popup-2" class="popup-btn" href="javascript:void(0);">Open window 2</a></p>

<div class="pop-overlay">
  <div id="popup-window" class="popup-window">
    <div class="inner">
      <h4>Installing WordPress</h4>
      <p>WordPress is well-known for its ease of installation. Under most circumstances, installing WordPress is a very simple process and takes less than five minutes to complete. Many web hosts now offer tools (e.g. Fantastico) to automatically install
        WordPress for you. However, if you wish to install WordPress yourself, the following guide will help. Now with Automatic Upgrade, upgrading is even easier.</p>
    </div>
    <a href="javascript:void(0);" class="btn-close">Close</a>
  </div>
  
  <div id="popup-window-2" class="popup-window">
    <div class="inner">
      <h4>Release of WordPress 5.1</h4>
      <p>Near the end of the month, WordPress 5.1 was released, featuring significant stability and performance enhancements as well as the first of the Site Health mechanisms that are in active development. Most prominent is the new warning for sites running long-outdated versions of PHP.</p>
    </div>
    <a href="javascript:void(0);" class="btn-close">Close</a>
  </div>
</div>
              
            
!

CSS

              
                * {
  margin: 0;
  padding: 0;
}
.pop-overlay {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
}
.popup-window {
  display: none;
  position: absolute;
  background: #fff;
  width: 90%;
  max-width: 520px;
  left: 50%;
  margin-left: -260px;
  margin-top: 20px;
  padding: 15px;
  border-radius: 5px;
  font-size: 1em;
  line-height: 1.2em;
  text-align: right;
  box-sizing: border-box;
}
.popup-window .inner {
  max-height: 360px;
  overflow-y: auto;
  background: #f4f4f4;
  padding: 10px;
  margin-bottom: 10px;
  text-align: left;
}
.popup-window .btn-close {
  display: inline-block;
  border: 1px solid #848484;
  border-radius: 3px;
  padding: 0 15px;
  color: #444444;
  line-height: 1.8em;
  text-decoration: none;
}
.popup-window .btn-close:hover,
.popup-window .btn-close:active,
.popup-window .btn-close:focus {
  text-decoration: none;
  background: #f4f4f4;
}
@media screen and (max-width: 600px) {
  .popup-window {
    margin-left: -45%;
  }
}

              
            
!

JS

              
                $(function() {
  var $popUpBtn = $(".popup-btn");
  var $popUp = $("#popup");
  var $popUp2 = $("#popup-2"); // for second window
  var $popOverlay = $(".pop-overlay");
  var $popWindowItem = $(".popup-window");
  var $popWindow = $("#popup-window");
  var $popWindow2 = $("#popup-window-2"); // for second window
  var $popClose = $(".popup-window .btn-close");

  $popUp.on("click", function() {
    $popOverlay.fadeIn();
    $popWindow.fadeIn();
  });
  
  // for second window
  $popUp2.on("click", function() {
    $popOverlay.fadeIn();
    $popWindow2.fadeIn();
  });

  $popClose.on("click", function() {
    $popOverlay.fadeOut();
    $popWindowItem.fadeOut();
  });

  $(function() {
    $(document).on("click", function(event) {
      if ($(event.target).closest($popUpBtn).length) return;
      if ($(event.target).closest($popWindowItem).length) return;
      $popOverlay.fadeOut();
      $popWindowItem.fadeOut();
      event.stopPropagation();
    });
  });
});

              
            
!
999px

Console