zoukankan      html  css  js  c++  java
  • 纯css实现modal弹窗

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
      <meta charset="UTF-8">
      <title>纯css实现弹窗</title>
      <style>
        * {
          margin: 0;
          padding: 0;
          font-size: 14px;
          font-family: Arial, Helvetica, sans-serif
        }
    
        .button {
          background: bisque;
          color: #fff;
          padding: 10px 25px;
        }
    
        .modal>input {
          display: none;
        }
    
        .modal>input~* {
          overflow: hidden;
          max-height: 0;
          opacity: 0
        }
    
        .modal .overlay {
          top: 0;
          left: 0;
          bottom: 0;
          right: 0;
          position: fixed;
          margin: 0;
          border-radius: 0;
          background: rgba(17, 17, 17, 0.6);
          transition: all 0.3s;
          z-index: 100000;
        }
    
        .modal .overlay~* {
          border: 0;
          position: fixed;
          top: 50%;
          left: 50%;
          transform: translateX(-50%) translateY(-50%) scale(0.2, 0.2);
          z-index: 1000000;
          transition: all .3s ease;
        }
    
        .main {
          background: #fff;
          padding: 10px;
        }
    
        .modal>input:checked~* {
          display: block;
          opacity: 1;
          max-height: 10000px;
        }
    
        .modal>input:checked~.overlay~* {
          max-height: 90%;
          overflow: auto;
          -webkit-transform: translateX(-50%) translateY(-50%) scale(1, 1);
          transform: translateX(-50%) translateY(-50%) scale(1, 1);
        }
    
      </style>
    </head>
    
    <body>
      <label for="modal_1" class="button">显示模态框</label>
    
      <div class="modal">
        <input type="checkbox" name="" id="modal_1">
        <label for="modal_1" class="overlay"></label>
        <div class="main">
          <p>
            We have a special offer for you. I am sure you will love it! However this does look spammy...
          </p>
        </div>
      </div>
    
    </body>
    
    </html>

    纯css3实现弹窗:参考链接https://picnicss.com/documentation#modal

  • 相关阅读:
    简单SSM配置详解
    Nginx 简介
    序列化与反序列化
    用HttpSessionListener与HttpSessionBindingListener实现在线人数统计
    Linux
    jsp标签精华(持续更新中)
    ZooKeeper 编程(一)
    maven环境快速搭建
    Web项目--------原Oracle数据库的项目同时兼容MySql
    JavaMail实现邮箱之间发送邮件功能
  • 原文地址:https://www.cnblogs.com/he-qiang/p/10874224.html
Copyright © 2011-2022 走看看