CSS3笔记——过渡 Transition

过渡 Transition

  • 允许CSS属性值在一定的时间区内平滑地过渡,

  • 在鼠标单击、获得焦点、被点击或对元素做任何改变中触发,并圆滑地以动画效果改变CSS属性值。

兼容性 :

IE10+、FireFox16+、Chrome26+、Safari6.1+、Opera12.1+


transition-property

语法:

transition-property: none | all |property


参数说明

  • none 没有属性改变
  • all 所有属性改变 (默认)
  • property(元素属性名)

实例:

颜色:transition-property: color

div {background-color: red;
            -webkit-transition-property: background-color;
               -moz-transition-property: background-color;
                -ms-transition-property: background-color;
                 -o-transition-property: background-color;
                    transition-property: background-color;
}

div:hover { background-color: blue;               
            -webkit-transition-property: background-color;
               -moz-transition-property: background-color;
                -ms-transition-property: background-color;
                 -o-transition-property: background-color;
                    transition-property: background-color;
}


transition-duration

检索或设置对象过度的持续时间

语法:

transition-duration: time;


单位:

  • s(秒)
  • ms(毫秒)


transition-timing-function

检索或设置过渡动画类型。
语法:

transition-timing-function: ease | linear | ease-in | ease-out | ease-in-out

参数说明:

  • linear:线性过渡 匀速运动,突然停下

  • ease :平滑过渡 慢-快-快(速度增加少)

  • ease-in: 由慢到快,然后突然就停下来了

  • ease-out:由快到慢,然后平稳地停下来

  • ease-in-out:慢-快-慢


transition-delay

检索或设置延迟过渡时间。

语法:

transition-delay: time;


单位:

  • s(秒)
  • ms(毫秒)


transition整合

语法:

transition: property duration timing-function delay ;

实例:

-webkit-transition: color 2s ease-in-out 1s;
   -moz-transition: color 2s ease-in-out 1s;
    -ms-transition: color 2s ease-in-out 1s;
     -o-transition: color 2s ease-in-out 1s;
        transition: color 2s ease-in-out 1s;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值