四分之一圆上可见边框

问题描述 投票:0回答:1

我想要实现圆形黑白图片和绿线的效果:

我知道如何将图片制作成圆形和黑白,但我不知道如何制作这条绿线。

这是我的代码:

.comitee-image {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: grayscale(100%);
  object-fit: cover;
}

有人可以帮助我吗?

css border
1个回答
0
投票

您可以将图像包装在

picture
元素内,然后使用
::after

img {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: grayscale(100%);
  object-fit: cover;
}
picture::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  width: 300px;
  height: 300px;
  border-radius: 100%;
  border: 10px solid green;
}
<picture>
<img src="https://media.istockphoto.com/id/491520707/photo/sample-red-grunge-round-stamp-on-white-background.jpg?s=612x612&w=0&k=20&c=FW80kR5ilPkiJtXZEauGTghNBOgQviVPxAbhLWwnKZk=" />
</picture>

© www.soinside.com 2019 - 2024. All rights reserved.