Image-sweeping highlight effect with CSS3

Source: Internet
Author: User

This sweeping effect, the general realization of ideas: With the CSS3 pseudo class to add a sweep of light layer, background white, transparency to see a person like setting; now use Transform:rotate () Rotate 45 degrees, the rest is the control layer position!

Here to explain is: continuous sweep effect, and ultimately through the CSS3 animate to achieve, animate properties can set the animation delay time, but can not set each time to repeat the interval between sweeping. The workaround is: the left,top position value of the sweep layer is set to the distance from the layer itself, and the time of each sweep is prolonged, thus realizing the effect of "repeated sweep of light at intervals".

Of course, the layer itself is to add Overflow:hidden attributes, so that the effect of sweeping the light will look more lifelike!!

CSS3 realize picture Portrait sweep light highlight effect, source code:

The code is as follows Copy Code
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Testing </title>
<script src= "Http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
<style>
*{margin:0;padding:0;}
Body, TD, input, TEXTAREA, select, Button{color: #5f5f5f;/*font:12px/1.5 "Microsoft Yahei", Tahoma,arial Geneva, sans-serif;*/}
. demonstrate{padding:20px;margin:10px auto;/*border:1px #bbb solid;*/border-radius:5px;}
. Description H3{color: #f00;p adding-bottom:8px;}
. Description p{padding-bottom:5px;}
. Description Strong{color: #080; border-bottom:1px dotted;}
. Description B{color: #7A7676;}
. txt{width:700px;height:300px border:1px solid #f00;}
. demo{width:100px; height:100px;display:block;overflow:hidden;-webkit-border-radius:100px;
-moz-border-radius:100px;
Border-radius:100px;background:url (Yun_qi_img/gws_rd=ssl) no-repeat; border:5px solid #f00; margin:100px auto; Position:relative;}
. Demo:before{content: "";p osition:absolute;left: -665px; Top: -460px;width:200px;height:6px;
Background-color:rgba (255,255,255,.5);
-webkit-transform:rotate ( -45DEG);
-moz-transform:rotate ( -45DEG);
-ms-transform:rotate ( -45DEG);
-o-transform:rotate ( -45DEG);
Transform:rotate ( -45DEG);
-webkit-animation:searchlights 3.8s ease-in 3s infinite;
-o-animation:searchlights 3.8s ease-in 3s infinite;
Animation:searchlights 3.8s ease-in 3s infinite;
}
@-webkit-keyframes searchlights {
0% {left: -665px. Top: -460px;}
to {left:473px; top:564px;}
}
@-o-keyframes searchlights {
0% {left: -105px; top:0}
to {left:13px; top:104px;}
}
@-moz-keyframes searchlights {
0% {left: -105px; top:0}
to {left:13px; top:104px;}
}
@keyframes searchlights {
0% {left: -105px; top:0}
to {left:13px; top:104px;}
}
</style>
<body>
<div class= "demonstrate" >
<div class= "description" >
<div class= "TXT" >
<a href= "Http://mail.qq.com/cgi-bin/feed?u=http://www.phpvar.com/feed" class= "Demo" ></a>
</div>
</div>
</div>
</body>

Spit Trough: There are many CSS3 online demo, the effect is very gorgeous, but generally are a large section of the code, no annotation notes, understand that it is time-consuming, it is a very painful thing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.