transition-property - CSS: Cascading Style Sheets 编辑

The transition-property CSS property sets the CSS properties to which a transition effect should be applied.

Note: The 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.

Syntax

/* 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;

Values

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.

Formal definition

Initial valueall
Applies toall elements, ::before and ::after pseudo-elements
Inheritedno
Computed valueas specified
Animation typediscrete

Formal syntax

none | <single-transition-property>#

where
<single-transition-property> = all | <custom-ident>

Examples

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 transitions article.

Specifications

SpecificationStatusComment
CSS Transitions
The definition of 'transition-property' in that specification.
Working DraftInitial definition

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:85 次

字数:6769

最后编辑:8 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文