css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <!-- 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
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................