css 蒙层

蒙层

 

利用z-index:

.mui-backdrop-other {
    position: fixed;
    top: 44px;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    background-color: rgba(0, 0, 0, .3);
}

 

利用伪元素做蒙层:

.element {
    position: relative;
}

.element:after {
    content: "哈哈哈,我是遮罩";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 100px;
    background-color: rgba(0, 0, 0, .6);
    color: #fff;
    text-align: center;
}

 

posted @ 2017-03-25 16:20  草木物语  阅读(1357)  评论(0编辑  收藏  举报