cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <div class="card">
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Incidunt deserunt velit in blanditiis, cupiditate possimus sapiente tenetur porro accusantium animi?</p>
  
  <button class="open">Modal</button>
</div>

<div class="modals">
  <div class="modal-content">
    <div class="modal-wrap">
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore ab officiis libero reiciendis voluptas hic quas sit aspernatur exercitationem numquam obcaecati dolore sed voluptates, at aliquam cum harum, necessitatibus, expedita quod et magni? Possimus maiores vero suscipit ipsum veritatis, omnis pariatur magnam voluptatibus quisquam sequi veniam quas, et, dignissimos perspiciatis.</p>
      <button class="close">Close</button>
    </div>
  </div>
</div>
            
          
!
            
              .card {
  position: relative;
}

.modals {
  color: #fff;
  display: none;
  position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
  
  &.active {    
    .modal-drop {
      transform-origin: 50%;
      transform: scale(1);
    }
    
    .modal-content {
      opacity: 1;
      transition: 0.5s ease-in 1.5s;
    }
  }
}

.modal-drop {
  background: hsl(250,30%,10%);
  border-radius: 50%;
  width: 150vh;
  height: 150vh;
  position: absolute;
  margin-left: -75vh;
  margin-top: -75vh;
  transition: transform 2s cubic-bezier(.25,1,.60,1), transform-origin 0s;
  transform: scale(0.001);
  transform-origin: 0 0;
}

.modal-content {
  background: hsl(250,30%,10%);
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  opacity: 0;
  z-index: 1;
  transition: 0.5s 0s;
  
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-wrap {
  flex: 1;
  width: 100%;
  max-width: 50em;  
}

/* Page Styling */

$font-size: 18/16*1em;

::selection {
  background: hsl(40,100%,65%);
  color: #fff;
}

::-moz-selection {
  background: hsl(40,100%,65%);
  color: #fff;
}

html, body {
  height: 100%;
}

body {
  background: hsl(30,10%,90%);
  color: hsl(200,50%,20%);
  font: #{$font-size}/1.65 'Open Sans', sans-serif;
  letter-spacing: 0.01em;
  text-rendering: optimizeLegibility;
  
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: #fff;
  flex: 1;
  max-width: 20em;
  padding: 3em;
  position: relative;
  width: 100%;
  
  &::before {
    content: '';
    border: 1px dotted hsl(165,80%,70%);
    position: absolute;
      top: 1.25em;
      right: 1.25em;
      bottom: 1.25em;
      left: 1.25em;
    pointer-events: none;
  }
  
  p {
    margin: 0.5em 0 1em;
    padding-bottom: 2em;
    border-bottom: 1px solid hsl(149,70%,90%);
    //text-align: center;
    //font-style: italic;
    //font-family: 'Playfair Display', serif;
  }
}

.open,
.close {
  background: linear-gradient(hsl(149,65%,74%),hsl(155,67%,68%));
  border: 1px solid hsl(155,67%,68%);
  border-bottom: 4px solid hsl(165,70%,55%);
  border-radius: 2px;
  color: #fff;
  font-weight: 600;
  margin-top: 0.5em;
  padding: 0.5em 1em 0.4em;
  text-shadow: 1px 1px 0 hsl(165,70%,55%);
  transition: 0.3s;
  
  &:hover {
    filter: brightness(90%) contrast(120%);
  }
  
  &:focus {
    box-shadow: 0 0 10px hsl(149,65%,74%);
    outline: none;
  }
  
  float: right;
}

.close {
  background: linear-gradient(hsl(10,95%,59%),hsl(360,95%,59%));
  border: 1px solid hsl(360,95%,59%);
  border-bottom: 4px solid hsl(360,95%,43%);
  text-shadow: 1px 1px 0 hsl(360,95%,43%);
  
  &:focus {
    box-shadow: 0 0 10px hsl(10,95%,59%);
  }
}
            
          
!
            
              var num = 15;

var modalBtn = document.querySelector('.open');
var closeBtn = document.querySelector('.close');

var modalContainer = document.querySelector('.modals');
var holdModals = document.createDocumentFragment();

for (var i = 0; i < num; i++) {
  var div = document.createElement('div');
  div.classList.add('modal-drop');
  div.style.top = Math.floor((Math.random() * 100)) + 'vh';
  div.style.left = Math.floor((Math.random() * 100)) + 'vw';
  div.style.transitionDelay = Math.random() + 's';
  holdModals.appendChild(div);
}
console.log();
modalContainer.appendChild(holdModals);

modalBtn.addEventListener('click',function(){
  modalContainer.style.display = 'block';  
  window.setTimeout(function(){
    modalContainer.classList.add('active');
  },0.1);
});

closeBtn.addEventListener('click',function(){
   modalContainer.classList.remove('active');
  
   window.setTimeout(function(){
    modalContainer.style.display = 'none';
  },3000);
});
            
          
!
999px
Loading ..................

Console