css 遮罩的写法

74 篇文章 0 订阅
35 篇文章 0 订阅

 

组件版本的

class PopContent extends Component{
    render() {
        const {awardContent,closeMask,imgUrl} = this.props;
        return(
            <div className="popMask">
                <div className="wrapContent">
                    <div className="popHeader" style={{background:"url("+win+")"}}>
                        <img src={imgUrl} alt=""/>
                    </div>
                    {   awardContent?
                        <div className="popContent">恭喜您获得{awardContent}</div>
                        :<div className="popContent">今天抽奖次数已用完</div>
                    }

                    <div className="popFooter">
                        <div className="buttonFooter" onClick={closeMask}>朕知道了</div>
                    </div>
                </div>
            </div>
        )
    }
}
对应的样式:

.popMask {
    position: absolute;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
}

.wrapContent {
    width: 660px;
    height: 600px;
    background-color: #fff;
    margin: auto;
    opacity: 1;
    position: relative;
}

.popHeader {
    width: 100%;
    height: 300px;
    position: relative;
}

.popHeader img {
    position: absolute;
    width: 400px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.popContent {
    width: 100%;
    height: 150px;
    background-color: #fff;
    font-size: 40px;
    text-align: center;
    line-height: 150px;
}

.popFooter {
    width: 100%;
    height: 150px;
    background-color: #fff;
    display: flex;
}

.buttonFooter {
    width: 80%;
    height: 120px;
    margin: auto;
    text-align: center;
    line-height: 120px;
    font-size: 50px;
    color: white;
    background-color: rgb(255, 142, 0);
}

效果

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值