为什么这么写我的动画效果没有慢慢从透明到不透明,而是一下子就出现了

来源:2-7 编程练习

qq_云水边静沐暖阳_04205942

2018-04-12 19:19:16

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>2-2</title>

    <style type="text/css">

        div {

            font-family: 'Microsoft Yahei';

            font-size: 60px;

            font-weight: bold;

            line-height: 600px;

            position: absolute;

            top: 0;

            right: 0;

            bottom: 0;

            left: 0;

            width: 800px;

            height: 600px;

            margin: auto;

            text-align: center;

            border: 5px solid #000;

            border-radius: 50%;

            /*此处写代码*/

            animation-name: trans;

            animation-duration: 10s;

            animation-delay: 3s;

            @keyframes trans{

                from{

                    opacity:0;

                }

                to{

                    opacity:1;

                }

            }

       }

   </style>

</head>

<body>

    <div>大家好,欢迎来到慕课网!</div>

</body>

</html>


写回答

1回答

蒙德彼岸

2018-04-13

@keyframes trans{

               from{

                    opacity:0;

                }

                to{

                    opacity:1;

                }

            }

这个应该要写在div样式的外面,你写在里面了,应该是这个问题

0
hq_云水边静沐暖阳_04205942
h 放在div外面也是不可以的啊
h018-04-24
共1条回复

0 学习 · 5760 问题

查看课程