gpt4 book ai didi

CSS - 在剪辑路径多边形上添加边框颜色

转载 作者:太空宇宙 更新时间:2023-11-03 22:52:33 25 4
gpt4 key购买 nike

我是第一次使用剪辑路径,我需要在此形状中添加边框。任何人都可以向我解释如何做到这一点?

.image-center {
width: 300px;
height: 300px;
margin: 0 auto;
}
.shape {
width: 300px;
height: 300px;
-webkit-clip-path: polygon(15% 0, 70% 0, 100% 50%, 70% 100%, 15% 100%, 0 70%, 20% 50%, 0% 30%);
clip-path: polygon(15% 0, 70% 0, 100% 50%, 70% 100%, 15% 100%, 0 70%, 20% 50%, 0% 30%);
}
img {
width: 300px;
height: 300px;
}
<div class="image-center">
<div class="shape">
<img src="http://www.businessadvisorsmd.com/wp-content/uploads/2016/01/masteraccounting-1.jpg" />
</div>
</div>

最佳答案

您可以使用多个投影滤镜来伪造它。没有太多支持,但 cli 路径也没有太多......

.image-center {
width: 300px;
height: 300px;
margin: 0 auto;
-webkit-filter: drop-shadow(2px 2px 0px red)
drop-shadow(2px -2px 0px red)
drop-shadow(-2px 2px 0px red)
drop-shadow(-2px -2px 0px red);
filter: drop-shadow(2px 2px 0px red)
drop-shadow(2px -2px 0px red)
drop-shadow(-2px 2px 0px red)
drop-shadow(-2px -2px 0px red);
}
.shape {
width: 300px;
height: 300px;
-webkit-clip-path: polygon(15% 0, 70% 0, 100% 50%, 70% 100%, 15% 100%, 0 70%, 20% 50%, 0% 30%);
clip-path: polygon(15% 0, 70% 0, 100% 50%, 70% 100%, 15% 100%, 0 70%, 20% 50%, 0% 30%);
}
img {
width: 300px;
height: 300px;
}
<div class="image-center">
<div class="shape">
<img src="http://www.businessadvisorsmd.com/wp-content/uploads/2016/01/masteraccounting-1.jpg" />
</div>
</div>

关于CSS - 在剪辑路径多边形上添加边框颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39515922/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com