在3D空间中,使用transform 属性的scale3d()函数可以对元素进行3D缩放操作
代码示例:
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><style>.perspective-container {perspective: 800px;margin-top: 100px;display: flex;justify-content: center;}.box-3d {width: 100px;height: 100px;background-color: #FF5733;transform-style: preserve-3d;/* 水平、垂直和深度方向都放大 1.2 倍 */transform: scale3d(1.2, 1.2, 1.2);}</style>
</head>
<body><div class="perspective-container"><div class="box-3d"></div></div>
</body>
</html>