Introduction
The Perspective Origin property is a property of CSS3. Which
is used to define where a 3D element is based on the axis (x and y-axis).
This property is only supported by Google Chrome and Safari ( With the help of (webkit-perspective-origin
property). When we define the property on any element its child elements are
effected, the element has not affected by this, in my case, I define this
property in div1 but it can affect both div2 and div3. This property only affects the 3D transformed elements.
Ex:
- <html>
-
- <head>
- <style type="text/css">
- #div1
- {
- position: relative;
- height: 150px;
- width: 150px;
- padding: 15px;
- margin: 45px;
- border: 2px solid Red;
- perspective: 150;
- perspective-origin: 10% 10%;
- -webkit-perspective: 150;
-
- -webkit-perspective-origin: 10% 10%;
-
- }
-
-
- #div2
- {
- padding: 50px;
- position: absolute;
- border: 2px solid black;
- background-color: Brown;
- transform: rotateY(40deg);
- -webkit-transform: rotateY(40deg);
-
- }
-
- #div3
- {
- padding: 150px;
- position: absolute;
- border: 1px solid black;
- background-color: Blue;
- transform: rotateY(40deg);
- -webkit-transform: rotateY(40deg);
-
- }
- </style>
- </head>
-
- <body>
- <div id="div1">
- <div id="div2">Mahak</div>
- <div id="div3">Mahak</div>
- </div>
- </body>
-
- </html>
The output will be: