css3图片过滤效果,鼠标放上后其它图片模糊,鼠标所在位置的图片是清淅的,有效索引出当前的图片,对图片的模糊处理是本特效的亮点,你完全可以将模糊的效果应用于其它的图片特效中,你同样也可借此代码研究一下HTML5中的CSS3技术。
体验效果:
http://keleyi.com/a/bjad/yin8b5eb.htm
代码如下:
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>css3图片模糊过滤特效-柯乐义</title>
6 <style>
7 .keleyi img{ width:200px; height:200px;}
8 .keleyi{
9 list-style: none;
10 margin: 10px auto; padding: 0;
11 width: 642px; /* (200+10+4)x3 */
12 font-size: 0; /* fix inline-block spacing */
13 }
14 .keleyi li{
15 display: inline-block;
16 *display: inline;
17 zoom: 1;
18 width: 200px; height: 200px;
19 margin: 2px;
20 border: 5px solid #fff;
21 -moz-box-shadow: 0 2px 2px rgba(0,0,0,.1);
22 -webkit-box-shadow: 0 2px 2px rgba(0,0,0,.1);
23 box-shadow: 0 2px 2px rgba(0,0,0,.1);
24 -webkit-transition: all .3s ease;
25 -moz-transition: all .3s ease;
26 -ms-transition: all .3s ease;
27 -o-transition: all .3s ease;
28 transition: all .3s ease;
29 }
30
31 .keleyi:hover li:not(:hover){
32 -webkit-filter: blur(2px) grayscale(1);
33 -moz-filter: blur(2px) grayscale(1);
34 -o-filter: blur(2px) grayscale(1);
35 -ms-filter: blur(2px) grayscale(1);
36 filter: blur(2px) grayscale(1);
37 opacity: .7; /* fallback */
38 }
39
40 </style>
41 </head>
42 <body>
43 <div style="width: 736px; margin: 0px auto;"><h2>css3图片模糊过滤特效·柯乐义</h2>
44 请使用支持CSS3的浏览器,移动光标到图片上。 <a href="http://keleyi.com/a/bjad/yin8b5eb.htm" target="_blank">原文</a>
45 </div>
46 <ul class="keleyi">
47 <li>
48 <img src="http://keleyi.com/image/a/mdvii14p.jpg"></li>
49 <li>
50 <img src="http://keleyi.com/image/a/968oqhtf.jpg"></li>
51 <li>
52 <img src="http://keleyi.com/image/a/crgi0c5y.jpg"></li>
53 </ul>
54 </body>
55 </html>