四时宝库

程序员的知识宝库

CSS蒙层+弹框(css蒙层底部模糊)

<!DOCTYPE html>
<html lang="en">
<head>
 <title></title>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <link href="css/style.css" rel="stylesheet">
 <style>
 * {
 margin: 0;
 }
 .mask {
 background-color: #7b7070;
 position: absolute;
 top: 0;
 left: 0;
 right: 0;
 bottom: 0;
 width: 100%;
 height: 100%;
 }
 .box {
 position: absolute;
 top: 50%;
 margin-top: -100px;
 background-color: #fff;
 height: 200px;
 width: calc(100% - 50px); //这里是水平居中的关键 margin-left = 50/2
 margin-left: 25px;
 text-align: center;
 border-radius: 5px;
 }
 </style>
</head>
<body>
 <div>
 <div class="mask"></div>
 <div class="box">
 <p>title</p>
 </div>
 </div>
</body>
</html>

发表评论:

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言
    友情链接