Home > Web Front-end > HTML Tutorial > Use of css3 transition attribute_html/css_WEB-ITnose

Use of css3 transition attribute_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:00:28
Original
1062 people have browsed it

Transition is to smoothly transition an attribute from one attribute value to another within a specified time to achieve animation effects.
This attribute is generally used with: hover

Let’s look at an example: Place the mouse on a div, and after 0.2 seconds, the background color of the div element will change to yellow in one second. The change method is linear

1 div{ background-color:red; transition:background-color 1s linear 0.2s;}2 div:hover{ background-color:yellow;}
Copy after login

<div>思思博士</div>
Copy after login

Before the mouse was placed:

The change process 0.2s after the mouse was placed:

The final effect when the mouse is placed on it:

Seeing how everyone uses this attribute here, you should have a good idea.

For this attribute, each parameter has a corresponding attribute name, which means that this attribute can be split and written.

Non-abbreviated form:

1 /*div{ background-color:red; transition:background-color 1s linear 0.2s;}*/2 div{background-color:red; transition-property:background-color; transition-duration:1s; transition-timing-function:linear; transition-delay:0.2s}3 div:hover{ background-color:yellow;}
Copy after login

Transition can also transition multiple effects. 🎜>

1 div{ background-color:red; color:black; height:50px; transition:background-color 1s linear,color 1s linear,height 1s linear;}2 3 div:hover{ background-color:yellow; color:#F00; height:100px;}
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template