关于使用CSS制作遮罩层

结构:整个组件分为A和B两个子部分。

内容区域为A部分,遮罩层为B部分。

父部分的类名为:.box,A部分为.content  B部分为 .mask

父级.box的代码如下:

position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 100;

A部分.content的代码:

 position: absolute;
 left:0;
 right: 0;
 bottom: 0;
 z-index: 50;
 background-color: rgb(255, 255, 255);

B部分.mask的代码:

position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color:rgb(102, 102, 102);
opacity: 0.7;

 

posted @ 2020-11-27 17:08  sunRise113  阅读(506)  评论(0编辑  收藏  举报