Pen Settings

HTML

CSS

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

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

              
                <button>click</button>

<div class="modal">  
  <div class="overlay">
    <div class="modal-content">
      <p>HELLO WORLD!</p>
      <p>HELLO WORLD!</p>
      <p>HELLO WORLD!</p>
      <p>HELLO WORLD!</p>
      <p>HELLO WORLD!</p>
      <p>HELLO WORLD!</p>
      <p>HELLO WORLD!</p>
      <p>HELLO WORLD!</p>
      <p>HELLO WORLD!</p>
    </div>
  </div>
</div>

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ac ornare metus. Duis luctus consequat consectetur. Integer eleifend metus et condimentum rutrum. Nam vel laoreet diam, in gravida metus. Etiam sagittis diam nec lacus sodales, id hendrerit quam convallis. Proin finibus pretium commodo. Nam et luctus metus. Nulla vitae augue est. Donec vitae tristique urna, id cursus nunc.</p>

    <p>Curabitur non ex suscipit, bibendum turpis sed, pretium turpis. Aliquam ullamcorper vulputate sem at tincidunt. Integer libero purus, egestas sed commodo ut, hendrerit vel felis. Quisque venenatis, felis eu dictum sagittis, erat odio porttitor dolor, et elementum nisl enim at tortor. Cras mollis dignissim tellus, in blandit erat. Etiam id cursus erat. Sed blandit lobortis lorem eget venenatis. Vestibulum efficitur cursus vulputate. Sed iaculis enim a dolor aliquet, ac semper ligula porta.</p>

    <p>Aenean aliquam dictum justo a tincidunt. Vivamus interdum nisl vitae nibh bibendum vulputate. Nulla lacus velit, semper sed lacus quis, lobortis feugiat leo. Etiam pharetra velit sit amet nulla varius, sit amet dignissim augue viverra. Quisque eu consectetur eros, quis porttitor tellus. Quisque vitae nulla quis turpis egestas mattis at eu justo. Morbi sed ligula non dui bibendum congue. Mauris ut tellus sed est porttitor faucibus eu a lorem. Vivamus quis rutrum turpis, ut viverra odio. Phasellus elementum pellentesque dictum. Nam ultrices orci nec erat tempus volutpat.</p>
              
            
!

CSS

              
                body.open {
  overflow: hidden;
}
.modal {
  display: none;
}  
.overlay {
  background-color: rgba(0, 0, 0, 0.8);
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  overflow-y: auto;
  transition: background-color 1s ease 0s;
}
.modal-content {
  display: table;
  background-color: #fff;
  margin: 2% auto 2%;
  padding: 20px;
  text-align: center;
  overflow: auto;
}
p {
  max-width: 500px;
}
              
            
!

JS

              
                $(document).ready(function() {
  // Display modal popup when button is clicked
  $("button").click(function() {
    $(".modal").fadeIn(800).show();  
    // Adding a class to hide the body scroll bar when modal is open
    $("body").addClass("open");
  }); 
  // Hide modal popup when overlay is clicked
	$(document).on("click", function(event) {
    if ($(event.target).has(".modal-content").length) {
			$(".modal").hide();
      $("body").removeClass("open");
		}
	});
});
// modal v2:  https://codepen.io/dragoeco/pen/qjqjgy
              
            
!
999px

Console