我有一个用CSS制作的垂直横幅,我想创建两个区域。
分离应为三角形。一面有背景和三角形'#34;应该保留那个背景。
在图像中更好地解释; - )
我即将这样做,但一个形状一直持续到最后......我被卡住了。
.box {
background-image:
linear-gradient(195deg, transparent 70%, #000 70%, #000 71%, #fff 71%),
linear-gradient(165deg, transparent 70%, #000 70%, #000 71%, #fff 71%),
url(https://images.unsplash.com/photo-1526327227970-4bda49fa3489?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=3c4bce33d96df6b18af53fb2dae3363e&auto=format&fit=crop&w=2700&q=80);
background-position: top, center;
background-size: 250px 100%, cover;
background-repeat: no-repeat;
}

<div class="box">
some text here<br> more text
</div>
&#13;
答案 0 :(得分:1)
您可以像这样调整代码:
.box {
padding: 50px 30px;
height:300px;
width:100px;
text-align: right;
background-image:
linear-gradient(200deg,transparent 70%,#000 70%,#000 71%,#fff 71%),
linear-gradient(160deg,transparent 70%,#000 70%,#000 71%,#fff 71%),
url(https://images.unsplash.com/photo-1526327227970-4bda49fa3489?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=3c4bce33d96df6b18af53fb2dae3363e&auto=format&fit=crop&w=2700&q=80);
background-position:bottom left,bottom right,center;
background-size:50% 600px,50% 600px,cover;
background-repeat:no-repeat;
display:flex;
align-items:flex-end;
}
&#13;
<div class="box">
some text here<br> more text
</div>
&#13;