webkit内核的滤镜

大家在前端开发中可能只听说过ie支持滤镜,现在好了,webkit内核的浏览器也有了自己的滤镜,以下是一个案例(测试要用最新的chrome哟!),供大家参考:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>图片墙</title>
		<style type="text/css">
		*{
		    margin: 0;
		    padding: 0;
		}
			ul{
			    width: 690px;
			    margin: 20px auto;
			    letter-spacing: -4px;
			    word-spacing: -4px;
			    font-size: 0;
			}
			li{
			    font-size: 16px;
			    letter-spacing: normal;
			    word-spacing: normal;
			    display: inline-block;
			    *display: inline;
			    zoom: 1;
			    list-style: none outside none;
			    margin: 5px;			    
			}
			img{
			    width: 128px;
			    height: 128px;
			}
			.gallery li:nth-child(2){
			    -webkit-filter: grayscale(0.5);
			}
			.gallery li:nth-child(3){
                -webkit-filter: sepia(1);
            }
            .gallery li:nth-child(4){
                -webkit-filter: saturate(0.8);
            }
            .gallery li:nth-child(5){
                -webkit-filter: hue-rotate(90deg);
            }
            .gallery li:nth-child(6){
                -webkit-filter: invert(1);
            }
            .gallery li:nth-child(7){
                -webkit-filter: opacity(0.2);
            }
            .gallery li:nth-child(8){
                -webkit-filter: blur(3px);
            }
            .gallery li:nth-child(9){
                -webkit-filter:drop-shadow(5px 5px 5px #ccc);
            }
            .gallery li:nth-child(10){
                -webkit-filter:saturate(6) hue-rotate(361deg) brightness(0.09);
            }
            .gallery:hover li:not(:hover){
                -webkit-filter: blur(2px) grayscale(1);
                opacity: .7;
            }
		</style>
	</head>
	<body>
	    <ul class="gallery">
	    	<li><img src="1.jpg" /></li>
	    	<li><img src="1.jpg" /></li>
	    	<li><img src="1.jpg" /></li>
	    	<li><img src="1.jpg" /></li>
	    	<li><img src="1.jpg" /></li>
	    	<li><img src="1.jpg" /></li>
            <li><img src="1.jpg" /></li>
            <li><img src="1.jpg" /></li>
            <li><img src="1.jpg" /></li>
            <li><img src="1.jpg" /></li>
	    </ul>
	</body>
</html>
展示效果:


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值