我看到的一切基本上都是使用一个背景图像,上面有一个线性渐变,这对我来说是不起作用的:
我有两个div,它们的背景图像在垂直方向上彼此相邻,比如50px的重叠.I would like to make the top 50px of the background image on the second div into a gradient so it fades in from transparent.个
以下是开始的设置:
* {
box-sizing: box-sizing:border-box;
}
div {
width: 200px;
height: 200px;
padding: 10px;
color: #fff;
}
.one {
background-image: url('https://stevish.com/wpstevishcom/wp-content/uploads/2009/06/picture-0051-300x225.jpg');
}
.two {
padding-top: 60px;
margin-top: -50px;
background-image: url('https://stevish.com/wpstevishcom/wp-content/uploads/2009/02/img_1530-large-225x300.jpg');
}
<div class="one">Unimportant content</div>
<div class="two">More unimportant content.</div>
这大概是我想要的样子:
我不能只是上传一个淡入另一个的背景图像,因为实际div的内容是可变高度的,背景只需要在两个div之间改变.