HTML前端开发之路——Transition

Transition属性简介,transition属性有三个子属性, property,duration和time-function,property指的是变化的属性,duration指的是变化时间,time-function值得是过渡动画的形式;

transition的三个自属性可以一起写在transition当中,例如

transition:background-color 1s linear;

也可以分开来写,例如

transition-property: background-color;

transition-duration: 1s;

transition-timing-function: linear;

同时使用多个变形

transition:background-color 1s linear,
           height 1s linear,
           transform 1s linear,
           color 1s linear,
           width 1s linear;

具体实现见以下代码示例:

<!DOCTYPE html>
<html>
<head lang="en">
   <meta charset="UTF-8">
   <title></title>
   <style>
       div{
           background-color: #5cafa5;
           padding: 10px;
           width: 100px;
           height: 100px;
           margin: 200px auto;
           color: black;
           text-align: center;
           transition: background-color 1s linear;
           /*transition-property: background-color;*/
           /*transition-duration: 1s;*/
           /*transition-timing-function: linear;*/
transition:background-color 1s linear,
                       height 1s linear,
                       transform 1s linear,
                       color 1s linear,
                       width 1s linear;
       }
       div:hover{
           background-color: brown;
           transform: rotate(360deg);
           height: 200px;
           width: 200px;
           color: white;
       }
   </style>
</head>
<body>
<!--transition:progertiy(属性)
dration
(整个动画执行时间)
timing-function
(过渡动画的形式)-->
<div>实例文字</div>
</body>
</html>


转载于:https://my.oschina.net/LeslieMay/blog/614473

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值