HTML5网页设计

图片效果

CSS3实现的图片模糊过滤效果

时间:2014-12-02 11:57来源:未知作者:user点击:
CSS3实现鼠标滑过清晰,其他列表图片模糊过滤效果。

CSS3实现鼠标滑过清晰,其他列表图片模糊过滤效果。


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS3实现的图片模糊过滤效果 - ShejiCool.com</title>
<style>
    body{
      background: #eee;
    }
img{ width:200px; height:150px;}
    .gallery{
      list-style: none;
      margin: 50px auto; padding: 0;
      width: 642px; /* (200+10+4)x3 */
      font-size: 0; /* fix inline-block spacing */
    }
    .gallery li{
        display: inline-block;
        *display: inline;
        zoom: 1;
        width: 200px; height: 150px;
        margin: 2px;
        border: 5px solid #fff;
        -moz-box-shadow: 0 2px 2px rgba(0,0,0,.1);
        -webkit-box-shadow: 0 2px 2px rgba(0,0,0,.1);
        box-shadow: 0 2px 2px rgba(0,0,0,.1);
        -webkit-transition: all .3s ease;
        -moz-transition: all .3s ease;
        -ms-transition: all .3s ease;
        -o-transition: all .3s ease;
        transition: all .3s ease;        
    }
    .gallery:hover li:not(:hover){       
        -webkit-filter: blur(2px) grayscale(1);
        -moz-filter: blur(2px) grayscale(1);
        -o-filter: blur(2px) grayscale(1);
        -ms-filter: blur(2px) grayscale(1);
        filter: blur(2px) grayscale(1);
        opacity: .7; /* fallback */        
    }
    /* Demo page only */
    #about{
        color: #999;
        text-align: center;
        font: 0.9em Arial, Helvetica;
    }
    #about a{
        color: #777;
    }   
  </style>
</head>
<body>
  <ul class="gallery">
     <li><a href="#"><img src="http://www.shejicool.com/images/demo/400_1.jpg" width="140" height="80" alt=""></a></li>
     <li><a href="#"><img src="http://www.shejicool.com/images/demo/400_2.jpg" width="140" height="80" alt=""></a></li>
     <li><a href="#"><img src="http://www.shejicool.com/images/demo/400_3.jpg" width="140" height="80" alt=""></a></li>
  </ul>
  <p style="text-align:center">请使用支持CSS3的浏览器测试效果!</p>
</body>
</html>
阅完本篇文章?您还可以: 收藏本文 文章挑错 朋友推荐