perspective property CSS Reference



Definition and Usage

The perspective CSS property determines the distance between the z=0 plane and the user in order to give to the 3D-positioned element some perspective. Each 3D element with z>0 becomes larger; each 3D-element with z<0 becomes smaller. The strength of the effect is determined by the value of this property.

Part of the 3D-elements that are behind the user, i.e. that their z-axis coordinate is greater than the value of the perspective CSS property are not drawn.

The vanishing point is by default placed at the center of the element, but its position can be changed using the perspective-origin property.

Using this property with a value different than 0 and none creates a new stacking context.

  • Initial none
  • Applies to transformable elements
  • Inherited no
  • Media visual
  • Computed Value the absolute length or none
  • Animatable yes, as a length
  • Canonical order the unique non-ambiguous order defined by the formal grammar

Syntax

Formal syntax: none | <length>
perspective: none
perspective: 20px     /* <length> values */
perspective: 3.5em
perspective: inherited

Values

none
Is a keyword indicating that no perspective transform has to be applied.
<length>
Is a <length> giving the distance from the user to the z=0 plane. It is used to apply a perspective transform to the element and its content. If it 0 or a negative value, no perspective transform is applied.

Examples

perspective:250px; perspective:350px; perspective:500px;
   
1
2
3
4
5
6
   
1
2
3
4
5
6
   
1
2
3
4
5
6

Compatibility

Desktop browsers

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 12-webkit 10.0 (10)-moz
16.0 (16)
10 15-webkit (Yes)-webkit

Mobile browsers

Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support 3.0-webkit 10.0 (10)-moz
16.0 (16)
NA Not supported (Yes)-webkit

Relative articles