建站软件 优化软件 编程软件 网页辅助 站群程序 网站程序 图像处理 资源教程 字体下载 推荐软件


您的位置:首页 > div+css > 怎么用css实现图片上传圆角效果

怎么用css实现图片上传圆角效果

时间:2015-09-24 08:41:02  来源:免费模板网 作者:风雪 阅读次数 tags圆角特效

由于现在的游戏网站都流行圆角图标,但我们不能一张张做成圆角再上传吧,我们肯定要通过css来实现,所以下面是我利用css+js实现的圆角显示效果。这样比直角看起来美观多了,那么它是怎么实现的呢

我们要的是这种效果,代码涉及到javascript,css,html
 代码如下  

.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代码

 代码如下  

<body>

 <div class="blogpart2">
  <div class="grp01">
   <img class="png" src="images/bg01.png" />
   <a href="/js06.html"><img src="images/img03.gif" /></a>        
  </div>
 </div> 
 <div class="blogpart2">
  <div class="grp01">
   <img class="png" src="images/bg01.png" />
   <a href="/js06.html"><img src="images/img02.gif" /></a>        
  </div>
  
 </div>
 <div class="blogpart2">
  <div class="grp01">
   <img class="png" src="images/bg01.png" />
   <a href="/js06.html"><img src="images/img01.gif" /></a>        
  </div>
  
 </div>    

</body>
</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<document.images.length; 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 = "<span " + imgID + imgClass + imgTitle 
             + " style="" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
             + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 
             + "(src='" + img.src + "', sizingMethod='scale');"></span>" 
             img.outerHTML = strNewHTML 
             j = j-1 
          } 
       } 
    }     

window.attachEvent("onload", correctPNG);


本文地址:https://www.freemoban.com/bjrm/2015/0924/2483.html

猜你喜欢
栏目推荐
模板推荐

Copyright:www.freemoban.com 免费模板网 All Rights Reserved 网站备案:辽ICP备19014872号-2   辽公网安备 21010602000376号  辽公网安备:42900402000182号

免责声明:本站部分资源来自互联网收集,版权归原创者所有,如果侵犯了你的权益,我们会及时删除侵权内容,联系QQ:1615187561 谢谢合作!