这篇文章主要介绍“怎么用css3实现当鼠标移进去时当前亮其他变灰效果”,在日常操作中,相信很多人在怎么用css3实现当鼠标移进去时当前亮其他变灰效果问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”怎么用css3实现当鼠标移进去时当前亮其他变灰效果”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <script type="text/javascript" src="js/prefixfree.min.js"></script> <title>用css3实现鼠标移进去当前亮其他变灰</title> </head> <style type="text/css"> *{margin: 0;padding: 0;font-size:12px;} .wrapper{border: 1px #708090 solid;width: 900px;margin: 100px auto;height: 300px;padding: 20px;border-radius: 8px;box-shadow: 2px 2px 6px #666,-2px -2px 6px #666;} li{list-style: none;} .box:hover li{opacity:0.2; } .box li{float: left;width:48px; height:48px;position:relative; margin-right:10px; -webkit-transition: opacity 1s ease-in-out; -moz-transition: opacity 1s ease-in-out; -ms-transition: opacity 1s ease-in-out; -o-transition: opacity 1s ease-in-out; transition: opacity 1s ease-in-out; } .box li:hover{opacity:1; } .box li a{position:absolute;left:-10px;width:80px;height:30px;top:-30px;color: #fff;font-weight:bold;background:#000;border-radius:8px;box-shadow:1px 0 2px #fff inset;text-align:center;opacity:0; -webkit-transition: opacity 1s ease-in-out; -moz-transition: opacity 1s ease-in-out; -ms-transition: opacity 1s ease-in-out; -o-transition: opacity 1s ease-in-out; transition: opacity 1s ease-in-out; } .box li:hover a{opacity:1; top:-30px;} .delicious { background-image:url("http://images.cnblogs.com/cnblogs_com/hxh-hua/478335/o_delicious.png"); } .digg { background-image:url("http://images.cnblogs.com/cnblogs_com/hxh-hua/478335/o_digg.png"); } .facebook { background-image:url("http://images.cnblogs.com/cnblogs_com/hxh-hua/478335/o_facebook.png"); } .flickr { background-image:url("http://images.cnblogs.com/cnblogs_com/hxh-hua/478335/o_digg.png"); } .linkedin { background-image:url("http://images.cnblogs.com/cnblogs_com/hxh-hua/478335/o_flickr.png"); } .box a{display: block;} </style> <body> <div class="wrapper"> <ul class="box"> <li class="delicious"><a href="#" >Delicious</a></li> <li class="digg"><a href="#" >Digg</a></li> <li class="facebook"><a href="#" >Facebook</a></li> <li class="flickr"><a href="#">Flickr</a></li> <li class="linkedin"><a href="#">LinkedIn</a></li> </ul> </div> </body> </html>
到此,关于“怎么用css3实现当鼠标移进去时当前亮其他变灰效果”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。