Home > Web Front-end > CSS Tutorial > Introduction to examples of using CSS3 transition effects

Introduction to examples of using CSS3 transition effects

高洛峰
Release: 2017-03-13 17:47:00
Original
1678 people have browsed it

This article mainly introduces CSS3 transition effect examples in detail, which has certain reference value. Interested friends can refer to it

The examples in this article share the CSS3 transition effect for everyone. For your reference, the specific content is as follows

Rendering:

Introduction to examples of using CSS3 transition effects

##Implementation code:

transition.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Transition</title>
    <style>
        #block {     
            width: 400px;     
            height: 300px;     
            background-color: #69C;     
            margin: 0 auto;     

            transition: background-color 1s, width 0.5s ease-out;     
            -webkit-transition: background-color 1s, width 0.5s ease-out;     
        }     
        #block:hover {     
            background-color: red;     
            width: 600px;     
        }     
    </style>
</head>
<body>
    <p id="block">

    </p>
</body>
</html>
Copy after login


##transitionDemo.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>TransitionDemo</title>
    <style>
        #wrapper {     
            width: 1024px;     
            margin: 0 auto;     
        }     
        .progress-bar-bg {     
            width: 960px;     
            /*background-color: aliceblue;*/     
            background-color: lightyellow;     
        }     
        .progress-bar {     
            height: 40px;     
            width: 40px;     
            background-color: #69C;     

            border: 1px solid lightyellow;     
            border-radius: 5px;     
        }     
        .progress-bar:hover {     
            width: 960px;     
        }     

        #bar1 {     
            -webkit-transition: width 5s linear;     
            /*-webkit-transition: width 5s steps(6, end);*/     
            /*-webkit-transition: width 5s step-start;*/     
        }     
        #bar2 {     
            -webkit-transition: width 5s ease;     
        }     
        #bar3 {     
            -webkit-transition: width 5s ease-in;     
        }     
        #bar4 {     
            -webkit-transition: width 5s ease-out;     
        }     
        #bar5 {     
            -webkit-transition: width 5s ease-in-out;     
        }     
    </style>
</head>
<body>
<p id="wrapper">
    <p>linear</p>
    <p class="progress-bar-bg">
        <p class="progress-bar" id="bar1"></p>
    </p>

    <p>ease</p>
    <p class="progress-bar" id="bar2"></p>

    <p>ease-in</p>
    <p class="progress-bar" id="bar3"></p>

    <p>ease-out</p>
    <p class="progress-bar" id="bar4"></p>

    <p>ease-in-out</p>
    <p class="progress-bar" id="bar5"></p>
</p>
</body>
</html>
Copy after login


Result analysis: After the mouse moves up, a transition animation will occur.

The above is the entire content of this article, I hope it will be helpful to everyone's study.

The above is the detailed content of Introduction to examples of using CSS3 transition effects. 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