<h1>Just testing a non modal modal</h1>
<div id="myModal" class="modal">
  <div class="modal-content" id="a1"> <span class="close">&#215;</span>
    <h2>This element will be displayed in a modal when you click the big red button</h2>
    <p>This text will be displayed in the modal also</p>
    <div class="loader">Loading...</div>
  </div>
</div>
<div> <a href="#a1" class="myBtn">Click Me</a> </div>
.myBtn {
  display: inline-block;
  cursor: pointer;
  color: #000;
  margin: 10px;
  text-decoration: none;
  background: #f00;
  border-radius: 6px;
  padding: 5px 15px;
  font-size: 2rem;
  color: #fff;
  box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}
.myBtn:hover {
  background: #000;
  box-shadow: -5px -5px 5px rgba(0, 0, 0, 0.3);
}
.modal{
  background:#ccc;
  padding:10px;
}
.modal.open {
  position: fixed; /* Stay in place */
  z-index: 99; /* Sit on top */
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  overflow: auto; /* Enable scroll if needed */
  background-color: rgb(0, 0, 0); /* Fallback color */
  background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */
}
.open .modal-content {
  background-color: rgba(255, 255, 255, 0.9);
  position: fixed;
  top: 20%;
  bottom: 20%;
  left: 20%;
  right: 20%;
  margin: auto;
  padding: 20px;
  box-sizing: border-box;
  z-index: 100;
  overflow: hidden;
}
.close{display:none;}
.open .close {
  display:block;
  color: red;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}
.open .close:hover,
.open .close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

/*Spinner borrowed from:
https://projects.lukehaas.me/css-loaders/
*/
.loader{display:none}
.open .loader,
.open .loader:after {
  display:block;
  border-radius: 50%;
  width: 10em;
  height: 10em;
}
.open .loader {
   position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  margin: auto;
  font-size: 10px;
  background: rgba(0, 0, 0, 0.6);
  text-indent: -9999em;
  border-top: 1.1em solid rgba(255, 255, 255, 0.2);
  border-right: 1.1em solid rgba(255, 255, 255, 0.2);
  border-bottom: 1.1em solid rgba(255, 255, 255, 0.2);
  border-left: 1.1em solid #ffffff;
  transform: translateZ(0);
  animation: load8 1.1s infinite linear;
}

@keyframes load8 {
  0% {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}
(function (d) {
  const myModal = d.querySelector("#myModal");
  const toggle = d.querySelector(".myBtn");
  const close = d.querySelector(".close");
  toggle.addEventListener("click", clickMenu);
  close.addEventListener("click", clickMenu);
  function clickMenu() {
    myModal.classList.toggle("open");
  }
})(document);
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.