有朋友問我要秀站網(wǎng)博客的logo圖片一閃而過的動(dòng)態(tài)效果,這個(gè)其實(shí)也是找來的,作為好學(xué)的前端,就分享給大家。

用到了偽類before,CSS3的animation。
<!DOCTYPE html>
<html>
<head>
<title>圖片效果</title>
<style type="text/css">
.banner{overflow:hidden;}
.banner img{float:left;width:200px;height:55px;background:none}
.banner img:hover{width:201px;height:56px}
.banner .logo{display:block;float:left;width:200px; height:50px}
.banner .logo:before{
content:"";
position: absolute;
left: -600px;
top: -600px;
width: 200px;
height: 15px;outline:px solid red;
background-color: rgba(255,255,255,.6);
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-animation: searchLights 2s ease-in 2s infinite;
-o-animation: searchLights 2.s ease-in 2s infinite;
animation: searchLights 2s ease-in 2s infinite;
}
@-webkit-keyframes searchLights {
0% { left: -200px; top: 0; }
to { left: 220px; top: 100px; }
}
@-o-keyframes searchLights {
0% { left: -200px; top: 0; }
to { left: 220px; top: 100px; }
}
@-moz-keyframes searchLights {
0% { left: -200px; top: 0; }
to { left: 220px; top: 100px; }
}
@keyframes searchLights {
0% { left: -200px; top: 0; }
to { left: 220px; top: 100px; }
}
</style>
</head>
<body>
 <p class="banner">
  <h1>
   <a href="http://www.vi586.com" class="logo">
    <img src="http://www.vi586.com/images/logo.png" height="54" width="216" alt="秀站網(wǎng)秀站網(wǎng)">
   </a>
  </h1>
 </p>
</body>
</html>
    
  
 

 
           
           
           
           
           
           
           
          






 
					
					
				