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.


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.


                <!-- you can place this modal window anywhere in the content -->
<div class="modal-wrapper">
  <div class="modal">
    <div class="close-modal">X</div>
    <div id="modal-content"></div>
<!-- end modal-wrapper -->

<div id="wrapper">
  <button href="#" class="modal-link">Open Modal</button>
  <!-- our JS calls the .modal-link class -->

<div class="show-in-modal hide">
  <h1>This is the modal content</h1>
<!-- our JS calls the .show-in-modal class -->


                // codepen only styles
.modal-link {
  width: 150px;
  height: 40px;
  margin: auto;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  border: none;
  border-radius: 5px;
  background: #00bfff;
  color: white;
  text-transform: uppercase;

// Styles for functionality
@media only screen and (min-width: 768px) {
  .hide {
    display: none;
  .show {
    display: block!important;
    .modal-wrapper {
        z-index: 999;
        position: absolute;
        left: calc((100vw - 600px)/2); // center the modal horizontally

    .modal {
        display: none;
        position: relative;
        width: 600px;
        min-height: 300px;
        padding: 20px 15px;
        background: #EEEEEE;
        color: #000000;
        text-align: center;

        .close-modal {
            position: absolute;
            top: 20px;
            right: 15px;
            cursor: pointer;

        h1 {
            font-size: 56px;
            margin: 35px 0;

        .entry-content {
            p {
                font-size: 16px;
// end of media query

@media only screen and (min-width: 1030px) {}
// end of media query


                jQuery(document).ready(function($) {
  // Close modal 
  $('.close-modal').click(function() {

  // Detect windows width function
  var $window = $(window);

  function checkWidth() {
    var windowsize = $window.width();
    if (windowsize > 767) {
      // if the window is greater than 767px wide then do below. we don't want the modal to show on mobile devices and instead the link will be followed.

      $(".modal-link").click(function(e) {
        var modalContent = $("#modal-content");
        var post_link = $('.show-in-modal').html(); // get content to show in modal
        //var post_link = $(this).attr("href"); // this can be used in WordPress and it will pull the content of the page in the href
        e.preventDefault(); // prevent link from being followed
        $('.modal').addClass('show', 1000, "easeOutSine"); // show class to display the previously hidden modal
        modalContent.html("loading..."); // display loading animation or in this case static content
        modalContent.html(post_link); // for dynamic content, change this to use the load() function instead of html() -- like this: modalContent.load(post_link + ' #modal-ready')
        $("html, body").animate({ // if you're below the fold this will animate and scroll to the modal
          scrollTop: 0
        }, "slow");
        return false;

  checkWidth(); // excute function to check width on load
  $(window).resize(checkWidth); // execute function to check width on resize