CSS Transitions and animations

Source: Internet
Author: User

First, Transition (transition):

1. Specify the name of the property used;

2. The specified length of time;

3. With the use of hover.

div{

width:100px;

height:50px;

background:red;

Transition:width 5s linear 2s;

}

div:hover{

width:1200px;

height:200px;

        

}

Second, animation (animation):

@keyframe rules are used to create animations. (The browser prefix must be added before the code to achieve compatibility)

1. Binding selector;

2. Animation name;

3. The duration of the animation.

div{

width:100px;

height:50px;

background:red;

border:1px Soild Black;

position:relative;

Animation:myfirst 5s linear 2s infinite;

}

@keyframe myfirst{

0% {backgroud:black; left:0px; top:0px;}

25%{background:yellow;left:200px;top:0px;}

50%{background:green;left:200px;top:200px;}

75%{background:bule;left:0px;top:200px;}

100%{background:red;left:0px;top:0px;}

}

CSS Transitions and animations

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.