css perspective-origin attribute
Translation results:
perspective
Perspective
英[pəˈspektɪv] 美[pərˈspektɪv]
origin
Origin
css perspective-origin attributesyntax
Role:perspective-origin attribute defines the X-axis and Y-axis on which the 3D element is based. This property allows you to change the bottom position of a 3D element. When you define the perspective-origin attribute for an element, its child elements get the perspective effect, not the element itself.
Syntax: perspective-origin: x-axis y-axis
Description: x-axis Define the view on the x-axis position on. Default value: 50%. Possible values: left center right length %
y-axis Defines the position of the view on the y-axis. Default value: 50%. Possible values: top center bottom length %
Note: This property must be used together with the perspective property, and only affects 3D transformation elements.
css perspective-origin attributeexample
<!DOCTYPE html>
<html>
<head>
<style>
#div1
{
position: relative;
height: 150px;
width: 150px;
margin: 50px;
padding:10px;
border: 1px solid black;
perspective:150;
-webkit-perspective:150; /* Safari and Chrome */
}
#div2
{
padding:50px;
position: absolute;
border: 1px solid black;
background-color: yellow;
transform: rotateX(45deg);
-webkit-transform: rotateX(45deg); /* Safari and Chrome */
}
</style>
</head>
<body>
<div id="div1">
<div id="div2">HELLO</div>
</div>
</body>
</html>Run instance »
Click the "Run instance" button to view the online instance
