美文网首页
模态框的css

模态框的css

作者: 姜治宇 | 来源:发表于2023-08-06 10:52 被阅读0次

模态框的css设计,需要注意的是:
1、模态框居中
只要把top、bottom、left和right都初始化即可。
2、关闭按钮
关闭按钮我们一般用x号代替。这个首先可以利用overflow、text-indent和boder属性,把原生的button清理掉无用的东西,然后把伪类元素定位到容器中央即可。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        
        .mask{
            position: fixed;
            top:0;
            bottom:0;
            left:0;
            right:0;
            background:rgba(0,0,0,0.3);
        }
        .content{
            position: fixed;
            top:3em;
            bottom:3em;
            left:20%;
            right:20%;
            padding:2em 3em;
            background:white;
            overflow:auto;
        }    
        .close{
            position: absolute;
            top:0.3em;
            right:0.3em;
            padding:0.3em;
            cursor:pointer;
            font-size:2em;
            height:1em;
            width:1em;
            text-indent: 10em;
            overflow:hidden;
            border:0;
        }
        .close::after{
            position:absolute;
            top:0.2em;
            left:0.2em;
            text-indent: 0;
            line-height: 0.6;
            content:"\00D7";
        }
    </style>
</head>
<body>
    <div class="dialog">
        <div class="mask"></div>
        <div class="content">
            <button class="close">关闭</button>
        </div>
    </div>
</body>
</html>

相关文章

  • 第十三节 MFC的一些概念

    一、模态对话框和非模态对话框Windows对话框分为两类:模态对话框和非模态对话框。模态对话框是这样的对话框,当它...

  • element-ui dialog组件嵌套bug

    模态框嵌套模态框 只需在子集的模态框里面添加append-to-body 就可以了 父级模框 子集模态框 我这样嵌...

  • 进阶任务10-事件应用

    实现Tab切换的功能 实现下图的模态框功能,点击模态框不隐藏,点击关闭以及模态框以外的区域模态框隐藏

  • bootstrap模态框多层嵌套,背景滚动

    问题:在弹出模态框A的基础上,弹出模态框B,关闭模态框B之后,模态框A不能滚动(由于A模块框内容) 造成的原因:遮...

  • 事件的应用

    1. 实现如下图Tab切换的功能 2. 实现下图的模态框功能,点击模态框不隐藏,点击关闭以及模态框以外的区域模态框隐藏

  • 进阶任务10

    1.实现如下图Tab切换的功能 2.实现下图的模态框功能,点击模态框不隐藏,点击关闭以及模态框以外的区域模态框隐藏

  • 事件的应用

    1.实现如下图Tab切换的功能: 2.实现下图的模态框功能,点击模态框不隐藏,点击关闭以及模态框以外的区域模态框隐藏

  • 小程序自定义模态框model

    自定义模态框,点击左侧模态框可以关闭显示

  • CSS 中的层叠上下文

    在使用 bootstrap 的模态框时,出现了半透明遮罩始终盖住模态框的情况,只有把模态框的 HTML 写到 bo...

  • modal 模态框

    Modal 模态框 标签(空格分隔): modal 什么叫做模态框 modal: adj.模态的;形态上的;情态的...

网友评论

      本文标题:模态框的css

      本文链接:https://www.haomeiwen.com/subject/hvoipdtx.html