zoukankan      html  css  js  c++  java
  • css 模态框

    居中显示模态框

    <style>
    body {
        height:1200px;
    }
    #alert-box {
        display:table;
        width:100%;
        height:100%;
        position:fixed;
        top:0;
        bottom:0;
        left:0;
        right:0;
        z-index:9999;
        background:rgba(0,0,0,0.5);
    }
    .alert {
        text-align:center;
        display:table-cell;
        vertical-align:middle;
    }
    .alert input {
        width:200px;
        height:30px;
        line-height:30px;
    }
    b {
        font-size:30px;
        color:#FF8400;
        cursor:pointer;
    }
    button {
        cursor:pointer;
    }
    </style>
    
    
    
    
    <b id='import_employee'>点我出现登录模态框</b>
    <div id="alert-box">
        <div class="alert">
            <p><input type="text" placeholder="请输入用户名" value="admin"></p>
            <p><input type="password" placeholder="请输入密码"></p>
            <button>登录</button>
        </div>
    </div>
    
    
    
    <script>
    let importEmployeeBtn = document.getElementById("import_employee");
    
    importEmployeeBtn.onclick = ()=>{
        document.getElementById("alert-box").style.display = "table";
    };
    
    document.getElementById("login").onclick = ()=>{
        document.getElementById("alert-box").style.display = "none";
    };
    
    
    
    
    </script>

    全屏模态框

    
            <style>
                #alert-box {
                    display:table;
                    width:100%;
                    height:100%;
                    position:fixed;
                    top:0;
                    bottom:0;
                    left:0;
                    right:0;
                    z-index:1;
                    background:rgba(0,0,0,0.5);
                }
                #alert-box .alert {
                    display:table-cell;
                    vertical-align:middle;
    
                }
    
                #alert-box .alert .base-content {
                    max-height: 100%;
                    max-width: 60%;
                    margin: auto;
                    background-color: #0c1a3f;
    
                }
                #alert-box .alert .base-content input {
                    width:200px;
                    height:30px;
                    line-height:30px;
                }
            </style>
    
    
            <div id="alert-box">
                <div class="alert">
                    <div class="base-content">
                        fsdafksakg'as
                    <p><label><input type="text" placeholder="请输入用户名" value="admin"></label></p>
                    <p><label><input type="password" placeholder="请输入密码"></label></p>
                    <button>登录</button>
                    </div>
    
                </div>
            </div>
    
            <script>
    
                // import_employee
                let importEmployeeBtn = document.getElementById("import_employee");
                importEmployeeBtn.onclick = ()=>{
                    document.getElementById("alert-box").style.display = "table";
                };
    
                $('button').on('click', function() {
                    document.getElementById("alert-box").style.display = "none";
                });
            </script>
  • 相关阅读:
    mysql实现主从复制
    go get时候 timeout
    linux 修改/etc/profile文件之后 没有效果
    初试 laravel
    php 实现单个大文件(视频)的 断点上传
    UEditor图片左对齐右对齐 要的作用显示之后 保存之后没有效果
    docker 实现 mysql+nginx+php
    redis
    easyPoi框架的excel导入导出
    从生产计划的角度认识精益生产
  • 原文地址:https://www.cnblogs.com/shizhengwen/p/15263720.html
Copyright © 2011-2022 走看看