English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules (RULES)

Complete List of CSS Properties

CSS3 transform-The usage method and example of style attribute

transform-The style CSS attribute specifies that the child elements of the element are positioned in3whether it is tiled in D space or in the element plane. If flattened, the child elements will not exist independently in three-dimensional space.

This attribute only applies to elements withtransformSpecify the child elements of the attribute.

The following table provides usage instructions and version history of this attribute, as well as its usage syntax in JavaScript scripts.

Default value:flat
Applies to:Transformable elements
Inheritance:None
Animatable:No.Please see Animation properties.
Version: CSS3new feature
JavaScript syntax:object.style.transformStyle="preserve-3d"

transform-The syntax of style usage

The syntax of this attribute is as follows:

transform-style: flat | preserve-3d | initial | inherit

The following examples demonstrate how to use transform-style attribute.

img {
    /* Chrome, Safari, Opera */
    -webkit-transform: rotate(30deg);
    -webkit-transform-style: preserve-3d;
    /* Firefox */
    -moz-transform: rotate(30deg);
    -moz-transform-style: preserve-3d;
    /* IE 9 */
    -ms-transform: rotate(30deg);
    -ms-transform-style: preserve-3d;
    
    transform: rotate(30deg);
    transform-style: preserve-3d;
}
Test to see‹/›

Attribute value

The following table describes the value of this attribute.

ValueDescription
flatThe child elements of the element are flattened, that is, located in the plane of the element itself. This is the default value.
preserve-3dThe child elements of the element should be placed in3in D space.
initialSet this attribute to its default value.
inheritIf specified, the associated elements adopt the parent element's transform-The value of style attributes.

Browser compatibility

transform-Browser compatibility of style attributes, the numbers in the table below represent the minimum version number of browsers that support this attribute; all mainstream browsers support this attribute.

  • Firefox 10+ -moz-,16 +

  • Chrome 12+ -webkit-,36+

  • Internet Explorer 11+

  • Apple Safari 4+ -webkit-

  • Opera 15+   -webkit-,23+

For further reading

Please refer to the following tutorial:CSS3 2D transformation,CSS3 3D transformation

Related attributes:backface-visibility,perspective,perspective-origin,transform,transform-origin.