Perspective
The perspective
property controls the perspective for 3D transformation.
Perspective Properties
perspective
Controls the distance between the user and the z = 0 plane. Specify:
none
— no perspective transform is to be applied- a length — e.g.
800px
, the distance from the user to the z = 0 plane
3D elements with z > 0 becomes larger; 3D elements with z<0 becomes smaller. The strength of the effect is determined by the value of perspective
.
Also, the parts of the 3D elements behind the user are not drawn.
perspective-origin
Sets the vanishing point for perspective
. Specify:
- a keyword — e.g.
center
,top
, ortop left
- a pair of lengths/percentages — e.g.
10px 10px
or25% 125%
(denoting where the vanishing point is on the x and y axes)
Other Properties
backface-visibility
Sets whether the back face of an element is visible when the back face is facing the user. (Only makes sense in 3D space, with 3D transformations.)
visible
— render it (mirror image of the front face) (default)hidden
— hide it (making the element invisible when turned away from the user)
Example
This example is taken from https://developer.mozilla.org/en-US/docs/Web/CSS/perspective-origin
| LIVE PREVIEW
1
2
3
4
5
6
References
- perspective (MDN) — https://developer.mozilla.org/en-US/docs/Web/CSS/perspective
- perspective-origin (MDN) — https://developer.mozilla.org/en-US/docs/Web/CSS/perspective-origin
- backface-visibility (MDN) — https://developer.mozilla.org/en-US/docs/Web/CSS/backface-visibility