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>

范例

Simple example

This example performs a four-second font size transition when the user hovers over the element, the transition-property is the font-size .

HTML

<a class="target">Hover over me</a>
					

CSS

.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.
工作草案 初始定义

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
transition-property Chrome 完整支持 26 Edge 完整支持 12 Firefox 完整支持 16
完整支持 16
完整支持 4 Prefixed
Prefixed Implemented with the vendor prefix: -moz-
preference (needs to be set to ). To change preferences in Firefox, visit about:config.
IE 完整支持 10
完整支持 10
完整支持 10 Prefixed
Prefixed Implemented with the vendor prefix: -ms-
Opera 完整支持 12.1
完整支持 12.1
Prefixed Implemented with the vendor prefix: -webkit-
不支持 11.6 — 15 Prefixed
Prefixed Implemented with the vendor prefix: -o-
Safari 完整支持 9 WebView Android 完整支持 ≤37 Chrome Android 完整支持 26 Firefox Android 完整支持 16
完整支持 16
完整支持 4 Prefixed
Prefixed Implemented with the vendor prefix: -moz-
preference (needs to be set to ). To change preferences in Firefox, visit about:config.
Opera Android 完整支持 12.1
完整支持 12.1
Prefixed Implemented with the vendor prefix: -webkit-
不支持 12 — 14 Prefixed
Prefixed Implemented with the vendor prefix: -o-
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

图例

完整支持

完整支持

用户必须明确启用此特征。

用户必须明确启用此特征。

要求使用供应商前缀或不同名称。

要求使用供应商前缀或不同名称。

另请参阅

元数据

  • 最后修改:
  1. CSS
  2. CSS 参考
  3. CSS Transitions
  4. 指南
    1. Using CSS transitions
  5. 特性
    1. transition
    2. transition-delay
    3. transition-duration
    4. transition-property
    5. transition-timing-function

Copyright  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1