設(shè)置3D場(chǎng)景
- perspective:800 //瀏覽器到物體的距離(像素)
- perspective-origin:50% (x軸) 50% (y軸) //視點(diǎn)的位置
- transform-style: preserve-3d;
示例:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#experiment{
-webkit-perspective: 800;
-webkit-perspective-origin: 50% 50%;
-webkit-transform-style: -webkit-preserve-3d;
}
.block{
width:500px;
height:500px;
text-align:center;
line-height:450px;/*牢記居中用行高 */
font-size:100px;
background-color:burlywood;
margin:100px auto;
transform:rotatex(45deg);
/*transform:rotatey(45deg);
transform:rotatez(45deg);*/
}
</style>
</head>
<body>
<div id="experiment">
<div class="block">css3</div>
</div>
</body>
</html>

01.jpg

02.jpg