When the mouse is moved up, there will be a flash of light across the picture, the effect is quite cool. So let’s realize this effect again:
The general idea is to design a transparent layer, skewx deforms by negative 25 degrees on the X-axis, the background color uses the linear gradient of CSS3 linear-gradient, and then hover time, set the animation time of 0.5s.
At the same time, use cursor:pointer on the i layer. If you do not set this, you need to wait for the transparent layer animation to see
It will be more clear!
<!DOCTYPE html > <html xmlns =“m.sbmmt.com/1999/xhtml”> <head> <meta http-equiv =“Content-Type”content =“text / html; charset = utf-8”/> <title>闪光图片</ title> <style> .overimg { 位置:亲戚; 显示:块; / * overflow:hidden; * / box-shadow:0 0 10px #FFF; } 。光{ cursor:pointer; 位置:绝对 左:-180px; 顶部:0; width:180px; height:90px; background-image:-moz-linear-gradient(0deg,rgba(255,255,255,0),rgba(255,255,255,0.5),rgba(255,255,255,0)); background-image:-webkit-linear-gradient(0deg,rgba(255,255,255,0),rgba(255,255,255,0.5),rgba(255,255,255,0)); 变换:skewx(-25deg); -o-transform:skewx(-25deg); -moz变换:skewx(-25deg); -webkit-transform:skewx(-25deg); } .overimg:hover .light { 左:180px; -moz-transition:0.5s; -o-transition:0.5s; -webkit转换:0.5s; 过渡:0.5s; } </ style> </ head> <body> <p class =“overimg”> <a> <img src =“m.sbmmt.com/librarys/images/201402/2014_02_15_01.jpg”> </a> <i class =“light”> </ i> </ p> </ body> </ html>
The above is the detailed content of CSS3 implements a cool flash effect code. For more information, please follow other related articles on the PHP Chinese website!