为什么 刚开始 箭头在最顶部闪一下 才执行下边的动画 请问怎么让开始就在下边闪呢?

来源:2-18 编程练习

TheRoo

2021-01-25 14:02:04

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>2-9</title>

    <style type="text/css">

        div {

            font-family: Arial;

            font-size: 72px;

            font-weight: bold;

            position: fixed;

            right: 0;

            left: 0;

            width: 30px;

            height: 30px;

            margin: auto;

            transform: rotate(90deg);

            /*此处写代码*/

            animation: downFrames 1s linear 0.5s infinite;

        }

        @keyframes downFrames{

            from {

                bottom: 30px;

            }

            to {

                bottom: 0px;

            }

        }

    </style>

</head>

<body>

    <div>&gt;</div>

</body>

</html>


写回答

1回答

好帮手慕慕子

2021-01-25

同学你好,对于你的问题解答如下:

1、因为箭头一开始就是在页面顶部显示的,动画开始时设置的bottom:30px;属性改变箭头在底部显示,动画延迟时间为0.5s,所以会导致箭头在顶部闪一下,然后瞬间移到bottom:30px;的位置开始动画。

2、可以设置箭头一开始就在下面显示,示例:

http://img.mukewang.com/climg/600e666d09b755c007020429.jpg

祝学习愉快~

0

0 学习 · 15276 问题

查看课程