css实现图片圆角边效果

因为朋友的关系,最近上facebook比较频繁。
发现上面的圆角图片并不是程序生成的(太费资源),仅仅用“定位”就解决了所有图片的圆角边效果。

该代码运用了 CSS Sprites 图片整合技术 将所有的圆角边框汇聚到一张PNG图片上(PNG兼容),然后外框加“相对定位 position:relative;”和“超出部分隐藏 overflow:hidden;”,在框内,应用绝对定位调整圆角的位置。附言:即日起,将不考虑IE6浏览效果

演示效果:
http://uicss.cn/wp-content/uploads/roundedimage-corners.html

CSS代码:

  1. #roundedimage{
  2. overflow:hidden; width:50px; height:50px;
  3. position:relative;
  4. }
  5. .UIRoundedImage_Corners {
  6. background:transparent none repeat scroll 0 0;
  7. display:block;height:100%;width:100%;
  8. overflow:hidden;
  9. position:absolute;top:0;left:0;
  10. }

html代码:

  1. <div id=roundedimage>
  2. <img alt=Kai Cui src=http://profile.ak.facebook.com/profile6/1918/57/q1070114775_5686.jpg/>
  3. <span class=UIRoundedImage_Corners>
  4. <img src=http://static.ak.fbcdn.net/images/ui/UIRoundedImage.png/>
  5. </span>
  6. </div>

出自 崔凯的博客

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>