HTML Dog
跳至导航

CSS 属性:transition-duration

过渡(即外观随时间发生的渐变)应进行的时间。

可能的值

描述示例
[时间]过渡的时长。默认值为 0s(即时过渡)。.3s
[时间][时间]多个时长可以用逗号分隔。它们将按顺序与在其他过渡属性(如 transition-property)中类似列出的项相匹配。.3s, 1s, 5s
inherit
initial
unset

示例


a {
    color: rgba(255,0,0,.5);
    transition-property: color;
    transition-duration: .3s;
}
/* A semi-transparent red link with a quick transition applied to the color property. */

a:hover {
    color: rgba(255,0,0,1);
}
/* When hovered over, the color of the link will gradually turn solid red over 0.3 seconds.  */

浏览器支持

css-transitions 支持情况? 来自 caniuse.com 的关于 css-transitions 功能在各大浏览器中支持情况的数据。