我正在尝试找出执行以下操作的最佳方法: 假设我有一个颜色为 x 的圆圈,我想在其中放置头像,我的目标是使头像图像也变圆,以使结果看起来更好。
我可以使用 php-gd 来做到这一点,但可能需要做很多计算(除非我错过了一些 gd 函数),是否有更好或更快的方法来解决它,例如 css?
蒂亚
最佳答案
如果我是你,为了简单起见,我会使用 CSS3。下面将把图像变成一个圆形,并给它一个 1px 的圆形边框。
div.avatar{
width:30px; height:30px; border:solid 1px #000;
-webkit-border-radius: 16px; -moz-border-radius: 16px; border-radius: 16px;
}
div.avatar img{
width:30px; height:30px;
-webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px;
}
<div class="avatar"><img src="" /></div>
- 老版本的 IE 不支持 CSS3
关于php - 阿凡达圆 Angular 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8945174/