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

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>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Est iure voluptatibus obcaecati debitis atque libero sequi iusto sint, quia vel consectetur possimus illo placeat veniam corporis? Nihil molestiae harum nesciunt.</p>
<button onclick="openModal()">Открыть модальное окно</button>
<p>Quam, tenetur vero ea, ullam sapiente molestiae dicta, voluptate voluptatibus incidunt quos praesentium assumenda sunt quia ratione sequi commodi accusamus officia est? Necessitatibus perferendis illum modi sunt dicta, soluta dolore.</p>
<p>Officiis ullam officia voluptate nobis numquam beatae, praesentium quam dolor nulla omnis nostrum assumenda voluptatibus? Quam illum quos incidunt quae possimus, alias officia assumenda hic eaque fugit facilis qui eligendi?</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Sunt placeat nesciunt provident numquam ipsa at eligendi optio laudantium veniam ipsam! Alias commodi tempore, ut quas eum odit soluta necessitatibus ratione?</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Sunt placeat nesciunt provident numquam ipsa at eligendi optio laudantium veniam ipsam! Alias commodi tempore, ut quas eum odit soluta necessitatibus ratione?</p>
<div class="modal">
  <div class="modal__dimmer" onclick="closeModal()"></div>
  <div class="modal__content">
    <div class="modal__close" onclick="closeModal()">&times;</div>
    <h1>Заголовок</h1>
    Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis in cupiditate quisquam, dolorem aliquid corporis ipsam ullam delectus ut est? Id culpa recusandae vero repellendus eaque repellat nisi consequuntur voluptatibus!
  </div>
</div>
              
            
!

CSS

              
                button {
  padding: 10px 15px;
  background: #fff;
  border: 1px solid;
}
.modal {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 32px;
  animation: fade 0.3s ease forwards;
  display: none;
  &.is_open {
    display: flex;
  }
  &.is_closing {
    animation: fadeOut 0.3s ease forwards;
  }
  &__dimmer {
    background: #0008;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
  }
  &__content {
    width: 300px;
    max-width: 100%;
    margin: auto;
    background: #fff;
    padding: 32px;
    z-index: 1;
    position: relative;
    animation: slideUp 0.3s 0.15s ease forwards;
    opacity: 0;
    box-shadow: 5px 5px 15px #0003;
    h1 {
      margin-top: 0;
    }
  }
  &__close {
    position: absolute;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    border: 2px solid;
    border-radius: 50%;
    top: -15px;
    right: -15px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s;
    &:hover {
      background: #000;
      color: #fff;
    }
  }
}
@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

              
            
!

JS

              
                function openModal() {
  document.querySelector(".modal").classList.add("is_open");
}
function closeModal() {
  document.querySelector(".modal").classList.add("is_closing");
  setTimeout(() => {
    document.querySelector(".modal").classList.remove("is_closing");
    document.querySelector(".modal").classList.remove("is_open");
  }, 300);
}

              
            
!
999px

Console