CSS3 animation effects

Source: Internet
Author: User

CSS3 animations need to follow the ' @Keyframes rules

Specify the duration of the animation

Specify the name of the animation

Here's an example.

In the. html file

1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4     <MetaCharSet= "UTF-8">5     <title>Animation</title>6     <Linkrel= "stylesheet"href= "Style04.css"type= "Text/css">7 </Head>8 <Body>9     <Div>Animation effects</Div>Ten </Body> One </HTML>

In the. css file

1 div{2 width:100px;3 height:100px;4 background-color:red;5 position:relative;6 Animation:anim 5s infinite alternate;/* infinite alternate repeat animation * /7 -webkit-animation:anim 5s infinite alternate;/*safari and Chrome Browser * *8 }9 @keyframes AnimTen { One 0%{ A background-color:red; - left:0px; top:0px; -     } the  - 25%{ - Background-color:blue; - left:200px;top:0px; +     } -  + 50%{ A Background-color:antiquewhite; at left:200px;top:200px; -     } -  - 75%{ - Background-color:blueviolet; - left:0px;top:200px; in     } -  to 100%{ + background-color:red; - left:0px;top:0px; the     } * } $ Panax Notoginseng @-webkit-keyframes anim{ - 0%{ the background-color:red; + left:0px; top:0px; A     } the  + 25%{ - Background-color:blue; $ left:200px;top:0px; $     } -  - 50%{ the Background-color:antiquewhite; - left:200px;top:200px;Wuyi     } the  - 75%{ Wu Background-color:blueviolet; - left:0px;top:200px; About     } $  - 100%{ - background-color:red; - left:0px;top:0px; A     } +}

CSS3 animation effects

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.