CSS3特效之过度transition

transition

语法

 
 
  1. transition:[ transition-property ] || [ transition-duration ] || [ transition-timing-function ] || [ transition-delay ]
  2. transition-propertyall | none | <property>[ ,<property> ]*:设置对象中的参与过渡的属性,默认值为all
  3. transition-duration:<time>[ ,<time> ]*:设置对象过渡的持续时间,默认值为0
  4. transition-timing-functionlinear | ease | ease-in | ease-out | ease-in-out | cubic-bezier(, , , )[,重复]*:设置对象中过渡的动画类型
  5. transition-delay:<time>[ ,<time> ]*:设置对象延迟过渡的时间

悬停切换背景

悬停切换背景
 
 
  1. .transition-1{
  2. padding:10px 20px;
  3. background-color:#f00;
  4. -webkit-transition:background 1s linear;
  5. -moz-transition:background 1s linear;
  6. transition:background 1s linear;
  7. }
  8. .transition-1:hover{
  9. background-color:#009;
  10. color:#fff;
  11. }

悬停旋转

旋转

 
 
  1. .transition-2{
  2. width:100px;
  3. height:100px;
  4. line-height:100px;
  5. text-align:center;
  6. border-radius:50px/50px;
  7. background-color:orange;
  8. -webkit-transition:all 1s linear;
  9. -moz-transition:all 1s linear;
  10. transition:all 1s linear;
  11. }
  12. .transition-2:hover{
  13. -webkit-transform:rotate(360deg);
  14. -moz-transform:rotate(360deg);
  15. transform:rotate(360deg);
  16. }

悬停缩放

放大

 
 
  1. .transition-3{
  2. width:100px;
  3. height:100px;
  4. line-height:100px;
  5. text-align:center;
  6. background-color:#369;
  7. -webkit-transition:all .5s linear;
  8. -moz-transition:all .5s linear;
  9. transition:all .5s linear;
  10. }
  11. .transition-3:hover{
  12. -webkit-transform:scale(1.2);
  13. -moz-transform:scale(1.2);
  14. transform:scale(1.2);
  15. }

组合过渡效果悬停测试效果

抱猫睡觉的鱼

 
 
  1. .transition-4{
  2. width:100px;
  3. height:100px;
  4. line-height:100px;
  5. text-align:center;
  6. border-radius:50px/50px;
  7. background-color:#963;
  8. -webkit-transition:all 1s linear;
  9. -moz-transition:all 1s linear;
  10. transition:all 1s linear;
  11. }
  12. .transition-4:hover{
  13. background-color:#909;
  14. color:#fff;
  15. box-shadow:0 0 20px rgba(0,0,0,.7);
  16. -webkit-transform:rotate(720deg) scale(2);
  17. -moz-transform:rotate(720deg) scale(2);
  18. transform:rotate(720deg) scale(2);
  19. }
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值