CSS3 Animations: Transitions

Source: Internet
Author: User

With CSS3, we can add an effect to an element when the element is transformed from one style to another without using Flash animation or JavaScript.

Please move the mouse over the green block below:

CSS3 transitions are the effects of an element gradually changing from one style to another.

To achieve this, two elements must be established:

    • Specify which CSS property you want to add the effect to
    • Duration of the specified effect

Properties Description CSS
Transition Shorthand property, which is used to set four transition properties in one property. 3
Transition-property Specifies the name of the CSS property that the transition is applied to. 3
Transition-duration Defines the time that the transition effect takes. The default is 0. 3
Transition-timing-function A time curve that specifies the transition effect. The default is "ease". 3
Transition-delay Specifies when the transition effect begins. The default is 0. 3

To achieve the above green block transition effect steps:

Only one div is defined in the HTML code, and no code is given here.

CSS code: starts to animate when the mouse is positioned over the element, and the mouse is removed back to the original

div{    width:100px;    height:100px;    Background: #24ff39;    transition-duration:2s,2s;//Set the execution time of the animation effect, the first parameter is the width change time, the second parameter is the height change time } div:hover{    width:200px;    height:200px;    Background: #ff1323;    Transform:rotate (360deg);}

The implementation results are as follows:

CSS3 Animations: Transitions

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.