Home >Web Front-end >CSS Tutorial >CSS perspective origin property

CSS perspective origin property

PHPz
PHPzforward
2023-09-14 13:49:10960browse

CSS 透视图原点属性

Use the perspective-origin attribute to specify the bottom position of the 3D element.

You can try running the following code to implement the perspective-origin attribute:

Example

Live Demonstration

<!DOCTYPE html>
<html>
   <head>
      <style>
        .demo1 {
            position: relative;
            width: 150px;
            height: 150px;
            background-color: yellow;
            perspective: 80px;
            margin: 50px;
            perspective-origin: left;
         }
         .demo2 {
            position: absolute;
            padding: 20px;
            background-color: orange;
            transform-style: preserve-3d;
            transform: rotateX(45deg);
         }
      </style>
   </head>

   <body>
      <h1>Rotation</h1>
      <div class = "demo1">Demo
         <div class = "demo2">Demo</div>
      </div>
   </body>
</html>

The above is the detailed content of CSS perspective origin property. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete