首页 > Web开发 > 详细

CSS之动画

时间:2017-07-30 22:40:39      阅读:206      评论:0      收藏:0      [点我收藏+]

 动画

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <style>
        @keyframes colorChange {
            0% {
                color: red;
            }
            20% {
                color: yellow;
            }
            50% {
                color: aquamarine;
            }
            80% {
                color: beige;
            }
            100% {
                color: chartreuse;
            }
        }

        P {
            font-size: 50px;
            /*动画名称*/
            animation-name: colorChange;
            /*动画时长*/
            animation-duration: 3s;
            /*动画速度曲线*/
            animation-timing-function: linear;
            /*动画延迟时间*/
            animation-delay: 2s;
            /*动画播放次数    infinite    无限次播放*/
            animation-iteration-count: 2;
            /*动画在下一个是否逆向播放*/
            /*animation-direction: alternate;*/

            animation-fill-mode: forwards;
        }
    </style>
    <title>动画</title>
</head>
<body>

<p>杰瑞教育</p>

</body>
</html>

运行效果是字体变色

 

鼠标触摸下滑栏

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <style>
        #container {
            width: 200px;
            height: 50px;
            background-color: #cccccc;
        }

        #top {
            width: 150px;
            height: 100%;
            float: right;
            background-color: #F2AD0A;
        }

        #hidden {
            width: 150px;
            height: 0px;
            background-color: #4D2E83;
            position: relative;
            top: 50px;
            transition: all 1s ease;
            overflow: hidden;
        }

        #top:hover #hidden {
            height: 300px;
        }
    </style>
    <title>老师做的栏</title>
</head>
<body>

<div id="container">
    <div id="top">
        <div id="hidden">
            <ul>
                <li>asfdasdf</li>
                <li>sdfasdf</li>
                <li>asdfjl</li>
            </ul>
        </div>

    </div>
</div>

</body>
</html>

运行图:

技术分享

光标移动到橙色区域后:出现下滑栏

技术分享

CSS之动画

原文:http://www.cnblogs.com/haloxinghong/p/7260605.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!