资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
纯CSS实现的当鼠标移上图片添加阴影效果代码
<html> <head> <title>CSS给图片添加阴影</title> <style> *{padding:0;margin:0;} body{background:#E8EDF1;padding:20px;} #profileAvatar {overflow:hidden;zoom:1;} #profileAvatar i{float:left;visibility:hidden;background:url(http://files.glzy8.com/demoimg/200912/avatar.gif) 0 0 no-repeat;} #profileAvatar i i{background-position:100% 0; } #profileAvatar i i i{background-position:0 100%;} #profileAvatar i i i i{padding:0 5px 6px 0;background-position:100% 100%; } #profileAvatar img{visibility:visible;display:block;padding:3px;border:1px solid #ccc;background:#fff;} </style> </head> <body> <div id="profileAvatar"> <i><i><i><i> <a href="http://www.glzy8.com" _ewebeditor_ta_href="http%3A%2F%2Fwww.glzy8.com"><img src="http://www.glzy8.com/images/logo.gif" _ewebeditor_ta_src="http%3A%2F%2Fwww.glzy8.com%2Fimages%2Flogo.gif" width="215" id="image" onmouseover="show()" onmouseout="show()" /></a> </i></i></i></i> </div> 鼠标移上去显示圆滑的阴影 <input type="button" value="缩小图片" onclick="document.getElementById('image').width -=10;" /> </body> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%20type%3D%22text%2Fjavascript%22%3E%20%0D%0A%20%20%20%20var%20imgBg%3Ddocument.getElementById('profileAvatar').getElementsByTagName('i')%20%0D%0A%20%20%20%20function%20show()%7B%20%0D%0A%20%20%20%20%20%20%20%20for(i%3D0%3Bi%3CimgBg.length%3Bi%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%7B%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if(imgBg%5Bi%5D.style.visibility%3D%3D'visible')%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20imgBg%5Bi%5D.style.visibility%3D'hidden'%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20else%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20imgBg%5Bi%5D.style.visibility%3D'visible'%20%0D%0A%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%7D%20%0D%0A%3C%2Fscript%3E"> </html>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程