CSS3(2)滤镜

Posted on 2017-04-08 21:15  Y_Mathison  阅读(156)  评论(0编辑  收藏  举报
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 

<style>
img {
    width: 33%;
    height: auto;
    float: left; 
    max-width: 235px;
}

.blur {-webkit-filter: blur(4px);filter: blur(4px);}
.brightness {-webkit-filter: brightness(250%);filter: brightness(250%);}
.contrast {-webkit-filter: contrast(180%);filter: contrast(180%);}
.grayscale {-webkit-filter: grayscale(100%);filter: grayscale(100%);}
.huerotate {-webkit-filter: hue-rotate(180deg);filter: hue-rotate(180deg);}
.invert {-webkit-filter: invert(100%);filter: invert(100%);}
.opacity {-webkit-filter: opacity(50%);filter: opacity(50%);}
.saturate {-webkit-filter: saturate(7); filter: saturate(7);}
.sepia {-webkit-filter: sepia(100%);filter: sepia(100%);}
.shadow {-webkit-filter: drop-shadow(8px 8px 10px green);filter: drop-shadow(8px 8px 10px green);}
</style>
</head>
<body>


<img src="image/321.jpg" alt="Pineapple" width="300" height="300">
<img class="blur" src="image/321.jpg" alt="Pineapple" width="300" height="300">
<img class="brightness" src="image/321.jpg" alt="Pineapple" width="300" height="300">
<img class="contrast" src="image/321.jpg" alt="Pineapple" width="300" height="300">
<img class="grayscale" src="image/321.jpg" alt="Pineapple" width="300" height="300">
<img class="huerotate" src="image/321.jpg"alt="Pineapple" width="300" height="300">
<img class="invert" src="image/321.jpg" alt="Pineapple" width="300" height="300">
<img class="opacity" src="image/321.jpg" alt="Pineapple" width="300" height="300">
<img class="saturate" src="image/321.jpg" alt="Pineapple" width="300" height="300">
<img class="sepia" src="image/321.jpg"alt="Pineapple" width="300" height="300">
<img class="shadow" src="image/321.jpg" alt="Pineapple" width="300" height="300">

</body>
</html>
-webkit-filter是CSS3属性,提供10种滤镜
  • grayscale 灰度              
  • sepia 褐色         
  • saturate 饱和度     
  • hue-rotate 色相旋转  
  • invert 反色       
  • opacity 透明度     
  • brightness 亮度     
  • contrast 对比度    
  • blur 模糊         
  • drop-shadow 阴影