我想创建这个只有背景的形状。或者可能是剪辑路径和伪元素。
到目前为止,我尝试使用 ::before
div {
height: 300px;
width: 400px;
background: tomato;
border-radius: 0 0 5px 0;
position: relative;
}
div::before {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: inherit;
height: 400px;
background: red;
bottom: -395px;
border-radius: 0 0 400px 0;
}
.abs {
width: 400px;
position: absolute;
top: 0;
left: 0;
}
body {
margin: 0;
}
<div></div>
<img src="https://i.hizliresim.com/LvZGL1.png" alt="" class="abs"> <!-- intended shape -->
最佳答案
您可以考虑将倾斜变换与一些溢出和半径相结合:
.box {
width: 200px;
height: 280px;
position: relative;
overflow:hidden;
}
.box:before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-bottom-right-radius: 100px 50px;
background: linear-gradient(26deg,red,blue);
transform: skewY(-26deg);
transform-origin: left;
}
<div class="box">
</div>
关于css - 我怎样才能用背景渐变制作这个形状?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57196016/