原理: 上面简单布置一层遮罩,利用skew 进行一次移动
预览
代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>css3实现闪光效果title>
<style>
.img{ position:relative;}
.mask{
background:-webkit-linear-gradient(0deg,rgba(255, 255, 255, 0),rgba(255, 255, 255, 0.7),rgba(255, 255, 255, 0));
-webkit-transform:skewx(-25deg);
-webkit-transition:all .5s;
width:200px;
height:200px;
position:absolute;
left:-150px;
top:0;
}
.img:hover .mask{
left:150px;
}
style>
head>
<body>
<div class="img">
<img src="http://placehold.it/200x200" />
<div class="mask">div>
div>
body>
html>