css过度效果

语法

transition:[,]*
= [ none | ] ||

取值

<’ transition-property ‘>:
检索或设置对象中的参与过渡的属性
<’ transition-duration ‘>:
检索或设置对象过渡的持续时间
<’ transition-timing-function ‘>:
检索或设置对象中过渡的动画类型
<’ transition-delay ‘>:
检索或设置对象延迟过渡的时间

缩写方式
transition:
        border-color .5s ease-in .1s,
        background-color .5s ease-in .1s,
        color .5s ease-in .1s;
拆分方式
transition-property: border-color, background-color, color;
transition-duration: .5s, .5s, .5s;
transition-timing-function: ease-in, ease-in, ease-in;
transition-delay: .1s, .1s, .1s;

案例演示

<!doctype html>
<html>
    <head>
        <title>test transtion</title>
        <style>
          ul{list-style: none;list-style-position: horizontal;}
          ul li{width:100px;height:50px;float:left;background-color:#eee;padding:10px;margin-left:10px;
                -webkit-transition:background-color .5s ease-in;
                -moz-transition:background-color .5s ease-in;
                transition:background-color .5s ease-in;
          }
          ul li:nth-child(1):hover{background-color:red;}
          ul li:nth-child(2):hover{background-color:green;}
          ul li:nth-child(3):hover{background-color:#90FF90;}
          ul li:nth-child(4):hover{background-color:#2DA2C9;}
        </style>
    </head>
    <body>
        <ul>
            <li>box1</li>
            <li>box2</li>
            <li>box3</li>
            <li>box4</li>
        </ul>
    </body>
</html>

transition-property 定义参与过渡效果的元素

取值

none:
不指定过渡的css属性
all:所有可以进行过渡的css属性
:指定要进行过渡的css属性

有过渡效果的属性
属性名称类型
background-colorcolor
background-imageonly gradients
background-positionpercentage, length
border-bottom-colorcolor
border-bottom-widthlength
border-colorcolor
border-left-colorcolor
border-left-widthlength
border-right-colorcolor
border-right-widthlength
border-spacinglength
border-top-colorcolor
border-top-widthlength
border-widthlength
bottomlength, percentage
colorcolor
croprectangle
font-sizelength, percentage
font-weightnumber
grid-*various
heightlength, percentage
leftlength, percentage
letter-spacinglength
line-heightnumber, length, percentage
margin-bottomlength
margin-leftlength
margin-rightlength
margin-toplength
max-heightlength, percentage
max-widthlength, percentage
min-heightlength, percentage
min-widthlength, percentage
opacitynumber
outline-colorcolor
outline-offsetinteger
outline-widthlength
padding-bottomlength
padding-leftlength
padding-rightlength
padding-toplength
rightlength, percentage
text-indentlength, percentage
text-shadowshadow
top length,percentage
vertical-alignkeywords, length, percentage
visibilityvisibility
widthlength, percentage
word-spacinglength, percentage
z-indexinteger
zoomnumber
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值