【发布时间】:2019-02-07 00:35:51
【问题描述】:
我正在努力使用clip-path 属性以创建抽象背景,并且我不想使用图像或 svg 文件,我尝试使用该属性但我无法实现此结果:
enter image description here
我的基本代码:
.bg{
height: 100vh;
margin: 0;
}
.shape-1{
-webkit-clip-path: polygon(0 0, 10% 45%, 100% 0);
clip-path: polygon(0 10%, 40% 36%, 100% 0);
background: #3e19c6;
height: 100%;
width: 100%;
position: absolute;
margin: 0;
z-index: -1;
}
.shape-2{
-webkit-clip-path: polygon(0 62%, 100% 21%, 100% 100%, 0% 100%);
clip-path: polygon(0 62%, 90% 21%, 100% 100%, 0% 85%);
background: #c61951;
height: 100%;
width: 100%;
position: absolute;
margin: 0;
z-index: -1;
}
<div class="bg">
<div class="shape-1"> </div>
<div class="shape-2"> </div>
</div>
【问题讨论】: