我想要实现与这个示例图片相同的效果,即在主图像后面有两层相同色调的颜色层:
以下是我迄今为止尝试过的方法:
我的尝试是将主要图像复制了3次,并将它们叠放在一起。然而,我仍然不知道如何为第二和第三个图像层添加样式,以达到与示例图片相同的效果。我尝试过模糊和磨砂玻璃效果,但看起来很难看。<div v-for="song in top4Songs" :key="song.id" class="song-container">
<div id="parent">
<div>
<div class="song-image-container">
<img :src="song.coverUrl">
</div>
<div class="song-info">
<div class="song-image-container2">
<img :src="song.coverUrl">
<h2>{{song.title}}</h2>
</div>
</div>
<div class="song-image-container3">
<img :src="song.coverUrl">
</div>
</div>
</div>
CSS
/* second layer */
.song-image-container
{
position:absolute;
top: 12px;
left: 12px;
z-index: 1;
}
/* first layer */
.song-image-container2 {
position: relative;
top: 0;
left: 0;
z-index: 2;
/* */
}
/*third layer*/
.song-image-container3
{
position: absolute;
top: 22px;
left: 22px;
z-index: 0;
}
非常感谢您对实现这种特定效果的任何建议。
::before
和::after
伪元素的单个元素来创建这种效果。 - davidleininger