SOURCE

console 命令行工具 X clear

                    
>
console
let modal = document.querySelector('.modal')

modal.style.display = "none"
function showModal() {
   modal.style.display = modal.style.display === "none" ? "block" : "none"
}
<button onclick="showModal()">modaldialog</button>
<div class="modal">
    <p class="bg">
    页面内容
</p>
<p class="dialog">
    <p class="content">
        弹出框
    </p>
</p>
</div>
.bg {
  height: 666px;
  width: 100%;
  font-size: 60px;
  text-align: center;
}
.dialog {
  z-index: 999;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.5);
}
.dialog .content {
  min-height: 300px;
  width: 600px;
  background: #fff;
  border-radius: 5px;
  border: 1px solid #ebeef5;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.modal {
    display: none;
}