有朋友问我要秀站网博客的logo图片一闪而过的动态效果,这个其实也是找来的,作为好学的前端,就分享给大家。
用到了伪类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="秀站网秀站网"> </a> </h1> </p> </body> </html>
转载请注明来源网址:https://www.mubanyun.com/news/1384.html
发表评论
评论列表(条)