因为朋友的关系,最近上facebook比较频繁。
发现上面的圆角图片并不是程序生成的(太费资源),仅仅用“定位”就解决了所有图片的圆角边效果。
该代码运用了 CSS Sprites 图片整合技术 将所有的圆角边框汇聚到一张PNG图片上(PNG兼容),然后外框加“相对定位 position:relative;”和“超出部分隐藏 overflow:hidden;”,在框内,应用绝对定位调整圆角的位置。附言:即日起,将不考虑IE6浏览效果
演示效果:
http://uicss.cn/wp-content/uploads/roundedimage-corners.html
CSS代码:
- #roundedimage{
- overflow:hidden; width:50px; height:50px;
- position:relative;
- }
- .UIRoundedImage_Corners {
- background:transparent none repeat scroll 0 0;
- display:block;height:100%;width:100%;
- overflow:hidden;
- position:absolute;top:0;left:0;
- }
html代码:
- <div id="roundedimage">
- <img alt="Kai Cui" src="http://profile.ak.facebook.com/profile6/1918/57/q1070114775_5686.jpg"/>
- <span class="UIRoundedImage_Corners">
- <img src="http://static.ak.fbcdn.net/images/ui/UIRoundedImage.png"/>
- </span>
- </div>