一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

css实现方角图片上传显示圆角效果

时间:2012-03-21 编辑:简简单单 来源:一聚教程网

先看效果图

我们要的是这种效果

 代码如下 复制代码

.box-163css{ width:600px; margin:20px auto;}
/*blogpart2*/
.blogpart2{ width:570px; text-align:left; padding-bottom:15px; overflow:hidden; float:left; margin-bottom:24px; background:url(../images/line02.gif) repeat-x left bottom; border:1px solid #000; padding:10px 0 10px 20px; background:#eee;}
.grp01{ width:68px; position:relative; height:68px; float:left; display:inline;}
.grp01 .png{ position:absolute; z-index:1000;}
.grp01 img{ width:68px; height:68px;}


html代码

 代码如下 复制代码

 


  

   
           
  

 
 
 

  

   
           
  

  
 

 

  

   
           
  

  
 
    


png.js代码

 代码如下 复制代码

// JavaScript Document

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])
    if ((version >= 5.5) && (document.body.filters))
    {
       for(var j=0; j        {
          var img = document.images[j]
          var imgName = img.src.toUpperCase()
          if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
          {
             var imgID = (img.id) ? "id='" + img.id + "' " : ""
             var imgClass = (img.className) ? "class='" + img.className + "' " : ""
             var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
             var imgStyle = "display:inline-block;" + img.style.cssText
             if (img.align == "left") imgStyle = "float:left;" + imgStyle
             if (img.align == "right") imgStyle = "float:right;" + imgStyle
             if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
             var strNewHTML = "              + " style="" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
             + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
             + "(src='" + img.src + "', sizingMethod='scale');">
"
             img.outerHTML = strNewHTML
             j = j-1
          }
       }
    }    
}
window.attachEvent("onload", correctPNG);

热门栏目