【发布时间】:2020-09-18 18:45:36
【问题描述】:
第一步:background-size: cover;
第二步:background-size: contain; background-repeat: no-repeat;
第三步是我需要的:第一个背景图片是cover,第二个是no-repeat的叠加层
此时我的 Html 包含一个div:
<div class="news" data-background="@item.ImageUrl">
我尝试了一些东西,但我总是只能添加一张图片,而不是第二张。
我怎样才能得到图片上最右边的例子?
关于 SCSS 文件的一些额外信息
.vertical .news {
position: relative;
box-sizing: border-box;
border-radius: 18px;
background-position: center;
background-size: cover;
background-color: $DarkTurquoise;
max-height: 85vh;
height: 80vh;
width: 30vw;
margin-bottom: 3vw;
margin-right: 1vw;
margin-left: 1vw;
overflow: hidden;
}
【问题讨论】: