23过渡——HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1{
            width: 1300px;
            height: 500px;
            background-color: silver;
            overflow: hidden;
        }
        .box2{
            width: 100px;
            height: 100px;
            background-color: rgb(236, 154, 47);
            margin-left: 0;
            margin-top: 50px;
            /* transition-property: ; 设置需要过渡效果的属性属性 property(属性) 
                                    all表示所有属性
            */
            transition-property: margin;

            /* transition-duration: ; 设置过渡所用的时间 duration(持续)
                                    单位:m  ms
            */
            transition-duration: 2s;
            
            /* transition-timing-function: ;过渡的时序函数 
                    可选值:
                            ease            默认值,慢->快->慢
                            linear          匀速运动
                            ease-in         加速运动 慢->快
                            ease-out        减速运动  快->慢
                            ease-in-out     先加速,再减速
                            cubic-bezier()  来制定时序函数
                                辅助网站:https://cubic-bezier.com
                            steps(n) 分步执行过渡效果,n是分步的次数
                            steps(n,y) 分步执行过渡效果,n是分步的次数
                                y的可选值:
                                    end  在时间结束时执行过渡效果(默认)
                                            比如:10s完成过渡,设置steps(5,end),那么就会第5s执行一次,第10s执行一次
                                    start 在时间开始时执行过渡效果
                                            比如:10s完成过渡,设置steps(5,start),那么就会第0s执行一次,第5s执行一次
            */
             transition-timing-function: ease-out;
             
            /* transition-delay: ;  表示过渡效果的延迟  delay(延期,推迟)*/


            /* transition  可以同时设置过渡的相关属性
                注意:duration和delay都是时间单位,第1个时间代表duration,第2个时间地表delay
             */
        }
        .box3{
            width: 100px;
            height: 100px;
            background: tomato;
            margin-left: 0;
            margin-top: 50px;
            transition-property: margin;
            transition-duration: 2s;
            transition-timing-function: ease-in;
        }
        .box4{
            width: 100px;
            height: 100px;
            background: tomato;
            margin-left: 0;
            margin-top: 50px;
            transition-property: width;
            transition-duration: 3s;
            transition-timing-function: ease-in;
            /* transition-delay: ;  表示过渡效果的延迟  delay(延期,推迟)*/
            transition-delay: 1s;
        }
        .box1:hover .box2,
        .box1:hover .box3{
            margin-left: 1200px;
        }
        .box1:hover .box4{
            width: 1300px;
        }
    </style>
</head>
<body>
    <div class="box1">
        <div class="box2"></div>
        <div class="box3"></div>
        <div class="box4"></div>    
    </div>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值