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


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


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.


                <div class="contents">

<div class="container">
  <button class="modal-btn modal-open" type="button" id="modalOpen">Open</button>

<div id="modal" class="modal">
  <div class="modal-overlay js-modal-close">
    <div class="modal-container">
      <div class="modal-content">
        <h2 class="modal-content-ttl">モーダルのタイトルです</h2>
        <p class="modal-content-txt">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quibusdam dignissimos delectus quia ducimus quae architecto repellat expedita rem ipsam quisquam esse, cum atque</p>
      </div><!-- /.modal-content -->
      <button class="modal-btn modal-close js-modal-close">Close</button>
    </div><!-- /.modal-container -->
  </div><!-- /.modal-overlay -->
</div><!-- /.modal -->
</div><!-- /.contents -->


                * {
  margin: 0;
  padding: 0;

  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic Pro N', Meiryo, sans-serif;

  max-width: 400px;
  padding: 80px 40px 0 40px;
  margin: 0 auto;

.modal-btn {
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  padding: 10px 20px;

  background: orangered;

  background: darkblue;

.modal {
  display: none;

.modal.is_open {
  display: block;

.modal-overlay {
  align-items: center;
  background: rgba(0, 0, 0, .75);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;

.modal-container {
  background: #fff;
  border-radius: 4px;
  max-height: 100%;
  max-width: 600px;
  padding: 30px 20px;
  overflow: scroll;

  font-size: 2rem;

  line-height: 1.67;


                const modalBtn = document.getElementById('modalOpen');
const modal = document.getElementById('modal');

const ms = 400; = 'opacity ' + ms + 'ms';

modalBtn.addEventListener('click', () =>{
  setTimeout(function(){ = 1}, 50);

let modalClose = document.querySelectorAll('.js-modal-close');
  for (let i = 0; i < modalClose.length; i++){
  modalClose[i].addEventListener('click', () => {
    setTimeout(function(){ = 0}, 1);
    setTimeout(function(){modal.classList.remove('is_open')}, ms)