Detailed explanation of CSS3 transition- and css3 transition

Source: Internet
Author: User

Detailed explanation of CSS3 transition- and css3 transition

0. Prepare the environment

 

(1) transition requires the support of the browser. To use these attributes, you must add the browser vendor prefix. The chrome 49 I use does not require the prefix,

 

-O-Opera

 

-Webkit-Safari and Chrome

 

-Moz-Firefox

 

-Ms-IE

 

(2) css

 

P

{

Height: 15px;/* This attribute is similar to height. The value must be specified */

 

    

}

P: hover/* initial p: hover */

{

 

    

Height: 100px;

}

 

(3) html file body

 

<P> </p>

 

1. Quick Start

 

Add the following attributes to the initial p: hover

 

Transition: background 2 s linear 1 s, height 1 s linear 1 s;

 

2. Detailed explanation

 

(1) specify and explain the attributes separately

 

Add the following attributes to the initial p: hover

Transition-property: height, background-color;

Transition-duration: 1 s, 2 s;

Transition-timing-function: linear;

Transition-delay: 1000 ms, 1 s;

Transition-property specifies the attribute to be changed

It is not recommended to write all, And the rules are hard to understand.

 

The transition-duration height is 1 s from execution to completion, and the background-color is 2 s from execution to completion. After the height change ends, there is 1 s left after the background-color change ends.

Write only one value, and apply this value to all attributes. In addition, set the number of transition-duration values to the number of transition-duration values.

 

Transition-timing-function: linear; the variation rule. Please find it here.

If only one value is written, this value is applied to all attributes. In addition, make the number of transition-timing-function values equal to the number of transition-property values.

 

Transition-delay: 1000 ms, 1 s; height changes after 1 s. Here, both background-color and height start to change.

If only one value is written, this value is applied to all attributes. In addition, set the number of transition-delay values to the number of transition-property values.

 

These attributes can only appear once. Otherwise

 

(2) Comprehensive use

 

Add the following attributes to the initial p: hover

 

Transition: background 2 s linear 1 s, height 1 s linear 1 s;

<Transition-property> <transition-duration> <transition-timing-function> <transition-delay>

<> Optional parameter. Please write it all

These attributes can only appear once. Otherwise

* Transition and other sub-write transitions are also covered, with the back covering the previous

Related Article

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.