求助:不改变html结构,只修改css让.box在最上层显示,且case要被cover遮罩层遮住。
<template>
<div class="container">
<div class="cover"></div>
<div class="case">
<div class="box"></div>
</div>
</div>
</template>
<style lang="scss" scoped>
.container {
height: 100vh;
background: #000;
.cover {
position: fixed;
background: rgba(255, 255, 255, 0.8);
width: 100%;
height: 100%;
left: 0;
bottom: 0;
z-index: 999;
}
.case {
position: fixed;
z-index: 100;
width: 800px;
height: 400px;
left: 50%;
top: 50%;
margin-left: -400px;
margin-top: -200px;
background: #fff;
display: flex;
.box {
width: 300px;
height: 200px;
background: #000;
position: fixed;
left: 50%;
top: 50%;
margin-left: -150px;
margin-top: -100px;
z-index: 99999;
}
}
}
</style>
研究了个把小时,累了,毁灭吧