Css 实现父元素设置 border-radius 时影响子元素圆角
实现效果
代码
<view class="my-group-page-card-img">
<image class="portrait-img" src="@/static/img/head portrait.jpg"></image>
<image class="portrait-img" src="@/static/img/head portrait2.jpg"></image>
<image class="portrait-img" src="@/static/img/head portrait3.jpg"></image>
<image class="portrait-img" src="@/static/img/head portrait4.jpg"></image>
</view>
<style scoped> .my-group-page-card-img {
width: 92upx;
height: 92upx;
font-size: 0;
border-radius: 17px;
overflow: hidden;
}
.portrait-img {
width: 46upx;
height: 46upx;
}
</style>
实现关键点在于 overflow: hidden;
还没有评论,来说两句吧...