我需要为 div 添加装饰。
上面和下面我已经添加了元素。
这是伪元素代码[scss]:
.content {
background-color: seashell;
width: 20vw;
height: 20vw;
margin-top: 4vw;
margin-bottom: 4vw;
border: 0.3vw solid #53b796;
border-radius: 1vw;
position: relative;
&:after{
content: "";
position: absolute;
top: 20vw;
left: 0.7vw;
width: 0;
height: 0;
border-left: 9vw solid transparent;
border-right: 9vw solid transparent;
border-top: 3vw solid #53b796;
}
&:before{
content: "";
position: absolute;
top: -3vw;
left: 0.7vw;
width: 0;
height: 0;
border-left: 9vw solid transparent;
border-right: 9vw solid transparent;
border-bottom: 3vw solid #53b796;
}
}
如何在左侧和右侧添加更多相同的元素?我怎样才能把这些三角形弄圆?边界半径不起作用。


尝试了所有选项。这里已经建议了。在互联网上,我找到了最懒惰和最快的方法。当然,它有它的缺点,但出于简单的目的,它可以做到。
clip-path 属性创建一个有界区域,指定元素的可见程度。
应用此属性的结果可以在链接 剪辑路径中看到
:before您不能为一个:after元素添加超过 1个。如果您需要更多 - 添加包装器div'ов更新:您可以使用矩形而不是三角形并玩弄
border-radius