transition-property
CSS
property sets the CSS properties to which a
transition effect
should be applied.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
注意: set of properties that can be animated is subject to change. As such, you should avoid including any properties in the list that don't currently animate, as someday they might, causing unexpected results.
If you specify a shorthand property (e.g.,
background
), all of its longhand sub-properties that can be animated will be.
/* Keyword values */ transition-property: none; transition-property: all; /* <custom-ident> values */ transition-property: test_05; transition-property: -specific; transition-property: sliding-vertically; /* Multiple values */ transition-property: test1, animation4; transition-property: all, height, color; transition-property: all, -moz-specific, sliding; /* Global values */ transition-property: inherit; transition-property: initial; transition-property: unset;
none
No properties will transition.
all
All properties that can transition will.
<custom-ident>
A string identifying the property to which a transition effect should be applied when its value changes.
| 初始值 | all |
|---|---|
| 适用于 |
所有元素,
::before
and
::after
pseudo-elements
|
| 继承 | no |
| 计算值 | 如指定 |
| 动画类型 | discrete |
none | <single-transition-property>#where
<single-transition-property> = all | <custom-ident>
This example performs a four-second font size transition when the user hovers over the element, the
transition-property
is the
font-size
.
<a class="target">Hover over me</a>
.target {
font-size: 14px;
transition-property: font-size;
transition-duration: 4s;
}
.target:hover {
font-size: 36px;
}
You will find more examples of
transition-property
included in the main
CSS 过渡
article.
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Transitions
The definition of 'transition-property' in that specification. |
工作草案 | 初始定义 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
transition-property
|
Chrome 完整支持 26 | Edge 完整支持 12 |
Firefox
完整支持
16
|
IE
完整支持
10
|
Opera
完整支持
12.1
|
Safari 完整支持 9 | WebView Android 完整支持 ≤37 | Chrome Android 完整支持 26 |
Firefox Android
完整支持
16
|
Opera Android
完整支持
12.1
|
Safari iOS 完整支持 9 | Samsung Internet Android 完整支持 1.5 |
IDENT
value
|
Chrome 完整支持 1 | Edge 完整支持 12 | Firefox 完整支持 16 | IE 完整支持 10 | Opera 完整支持 15 | Safari 完整支持 4 | WebView Android 完整支持 ≤37 | Chrome Android 完整支持 18 | Firefox Android 完整支持 16 | Opera Android 完整支持 14 | Safari iOS 完整支持 3 | Samsung Internet Android 完整支持 1.0 |
完整支持
用户必须明确启用此特征。
要求使用供应商前缀或不同名称。
transition
transition-duration
transition-timing-function
transition-delay
TransitionEvent
transition
transition-delay
transition-duration
transition-property
transition-timing-function