在我的网站上,我想在特定区域显示个人资料图片呈圆形。在我的文件夹中,它位于矩形页面中。为此,我正在使用以下样式但不起作用
<div class="circle">
<img src="~/Content/Member/MemberPhotos/default_user_icon.jpg"/></div>
</div>
试图用形状图像遮盖
.circle {
width:100px;height:100px;
overflow: hidden;
-webkit-mask-image: url(crop.png);
}
还尝试了以下 css
.circle {
width:100px;
height:100px;
border-radius: 50px;
background-color:#000;
clip: rect(0px,50px,100px,0px);
}
两者都没有被屏蔽。任何人都请帮助我
最佳答案
<div class="circle">
<img src="~/Content/Member/MemberPhotos/default_user_icon.jpg" style="border-radius: 50% 50% 50% 50%" />
</div>
应该这样做。
关于html - 使用 css 进行图像 mask ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18507976/