欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

简单弹窗的设置(CSS方式)

程序员文章站 2022-07-13 12:52:50
...
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style lang="">
        .message-box-wrapper {
            position: fixed;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
            text-align: center;
            background-color: rgba(0, 0, 0, .3)
        }
        
        .message-box-wrapper::after {
            content: "";
            display: inline-block;
            height: 100%;
            width: 0;
            vertical-align: middle;
        }
        
        .message-box {
            display: inline-block;
            vertical-align: middle;
            position: relative;
            width: 300px;
            height: 200px;
            background: #ffffff;
        }
        
        .message-box-content {
            padding: 30px 20px;
        }
        
        .message-box-btns {
            position: absolute;
            bottom: 0;
            width: 100%;
            height: 50px;
        }
        
        .message-box-cancel,
        .message-box-confirm {
            float: left;
            width: 50%;
            height: 100%;
            line-height: 50px;
            color: #ffffff;
        }
        
        .message-box-cancel {
            background-color: #8f9498;
        }
        
        .message-box-confirm {
            background-color: #FF6400;
        }
    </style>
</head>

<body>
    <div class="message-box-wrapper">
        <div class="message-box">
            <div class="message-box-header"></div>
            <div class="message-box-content">this is content</div>
            <div class="message-box-btns">
                <div class="message-box-cancel">取消</div>
                <div class="message-box-confirm">确定</div>
            </div>
        </div>
    </div>
</body>

</html>

简单弹窗的设置(CSS方式)