我的scss文件中有这样的代码:
#mainBox {
position: relative;
width: 100%;
height: 100vh;
display: flex;
}
.imageBox::before {
content: '';
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(225deg, #e91e63, #03a9f4);
z-index: 99;
mix-blend-mode: screen;
}
.imageBox {
position: relative;
width: 50%;
height: 100%;
img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
}
一切都很好,但我做不到::在工作之前。我试着用:ng深,但没用。
编辑:
<div id="mainBox">
<div class="imageBox">
<img src="../assets/images/loginPageDoctor.jpg" alt="">
</div>
<div class="contentBox">
Some content here
</div>
</div>
这是我的HTML代码。图像和内容有两个容器。
它应该放在class
标记之后。在本例中,p
是段落的标记。
p::before {
margin-left: 2rem;
}