HTML CSS examples for CSS Property:perspective-origin
The perspective-origin CSS property defines the vanishing point for the 3D space for the perspective property.
The following table summarizes the perspective-origin Property.
Item | Value |
---|---|
Default value: | 50% 50% |
Applies to: | Transformable elements |
Inherited: | No |
Animatable: | Yes. |
The syntax of the property is as follows:
perspective-origin: [ x-position y-position ] | initial | inherit
If only one value is set, the second value is assumed to be center, which is equal to 50% value.
The following table describes the values of this property.
Value | Description |
---|---|
x-position | Represents the horizontal position of the perspective origin. |
y-position | Represents the vertical position of the perspective origin. |
initial | Sets this property to its default value. |
inherit | take the value of its parent element perspective-origin property. |
x-position can have one of the following values:
y-position can have one of the following values:
The example below shows the perspective-origin property.
<!DOCTYPE html> <html lang="en"> <head> <title>Example of CSS3 perspective-origin Property</title> <style type="text/css"> .container{<!-- w w w . j a va 2s . c o m--> width: 125px; height: 125px; perspective: 300px; perspective-origin: 20% top; border: 4px solid #a2b058; background: #f0f5d8; } .transformed { -webkit-transform: rotate3d(0, 1, 0, 60deg); /* Chrome, Safari, Opera */ transform: rotate3d(0, 1, 0, 60deg); /* Standard syntax */ } </style> </head> <body> <div class="container"> <img src="https://www.java2s.com/style/demo/Opera.png" class="transformed" alt="Club Card"> </div> </body> </html>