x
 
<!DOCTYPE html>
<html>
<head>
<style>
#div1 {
  position: relative;
  margin: auto;
  height: 150px;
  width: 250px;
  padding: 10px;
  border: 1px solid black;
  perspective: 125px;
}
#div2 {
  padding: 50px;
  position: absolute;
  border: 1px solid black;
  background-color: coral;
  transform: rotateX(45deg);
}
</style>
</head>
<body>
<p>点击“试一试”按钮可更改 DIV1 元素的 perspecive-origin 属性:</p>
<button onclick="myFunction()">试一试</button>
<div id="div1">DIV1
  <div id="div2">把自己想象成一只鸟,俯视着一堵墙。然后点击按钮看看如果墙向左移动会发生什么!</div>
</div>
<script>
function myFunction() {
  document.getElementById("div1").style.perspectiveOrigin = "10px 50%";
}
</script>
</body>
</html>