老师,辛苦检查下

来源:2-14 编程练习

Lanny_Chung

2022-03-15 21:58:58

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        #myTest{
            width: 100px;
            height: 100px;
            text-align: center;
            line-height: 100px;
            background-color: #f43838;
            margin: auto;
            margin-top: 100px;
            color: #FFF;
            cursor: pointer;
            font-size: 20px;
            font-weight: bold;
        /*添加代码*/
            transition:border-radius,background-color,transform 0.5s linear 0s;
        }
        #myTest:hover{
            /*添加代码*/
            border-radius:50%;
            background-color:green;
            transform:scale(2);
        }
    </style>
</head>
<body>
    <div id="myTest">  duang! </div>
</body>
</html>


写回答

1回答

好帮手慕星星

2022-03-16

同学你好,代码中过渡效果写的不对,浏览器解析如下:

https://img.mukewang.com/climg/62313f560908a4b406410101.jpg

过渡时间,速度曲线以及延迟时间都是给最后一个属性transform添加的,前面两个使用默认的属性值,最后导致效果不同步。每个过渡的属性效果都要写完整,如下

https://img.mukewang.com/climg/6231401209caef1c10650093.jpg

或者简单一些,过渡属性写为all

https://img.mukewang.com/climg/6231409409eff88410460147.jpg

祝学习愉快!

0

0 学习 · 17877 问题

查看课程