Home > Web Front-end > CSS Tutorial > Introduce the differences between css3 transition and animation

Introduce the differences between css3 transition and animation

PHPz
Release: 2017-04-02 10:19:20
Original
3641 people have browsed it

CSS3 Transition

In CSS3, when we can change from one style to another in order to add a certain effect, there is no need to use FlashAnimation or JavaScript . Move the mouse over the following element:

That is to say, after we set the element transition, if we suddenly change the attribute of the element, it will slowly transition over,

Include the following methods. When the width of an element is suddenly changed, it will change to the value you changed after 2 seconds.

div
{
    transition: width 2s;
    -webkit-transition: width 2s; /* Safari */
}
Copy after login

CSS3 animation

CSS3, we can create animation, it can Replaces many web page animated images, Flash animations, and JAVAScripts.

@keyframes myfirst
{
    from {background: red;}
    to {background: yellow;}
}
  
@-webkit-keyframes myfirst /* Safari 与 Chrome */
{
    from {background: red;}
    to {background: yellow;}
}
Copy after login

Animation is a preset animation process, and CSS3 will be executed according to this process.

The above is the detailed content of Introduce the differences between css3 transition and animation. For more information, please follow other related articles on the PHP Chinese website!

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