这是一个js小提琴:http://jsfiddle.net/gnbL88w0/1/
<head>
<style>
#test {
background: red;
width: 200px;
height: 200px;
transform: rotateY(90deg);
}
</style>
</head>
<body>
<div id="test"></div>
<div id="output"></div>
<script>
var test = document.getElementById("test");
var output = document.getElementById("output");
output.innerHTML = window.getComputedStyle(test).transform;
</script>
</body>
当我将transform:rotateY(90deg)应用于div并尝试通过window.getComputedStyle()获取变换矩阵时,它返回:
matrix3d(6.12323399573677e-17,10,-1,0,0,1,0,0,1,0,6122323399573677e-17,1,0,0,0,1)
而FF例如返回:
matrix3d(0,0,-1,0,0,1,0,0,1,0,0,0,0,0,0,1);
IE 11返回:
matrix3d(0,0,-1,0,0,1,0,0,1,0,0,0,0,0,0,1);
问题是 - 为什么chrome返回6.12323399573677e-17而不是0?