CSS 参考手册
CSS3 backface-visibility 属性
backface-visibility在线实例
源代码:
点击运行 »
<!DOCTYPE html> <html> <head> <style> #div1 { width: 120px; height: 100px; background-color: yellow; border: 1px solid black; transform: rotateY(25deg); -webkit-transform: rotateY(25deg); /* Safari and Chrome */ -moz-transform: rotateY(25deg); /* Firefox */ } </style> <script> function rotate(value) { document.getElementById('div1').style.webkitTransform = "rotateY(" + value + "deg)"; document.getElementById('div1').style.MozTransform = "rotateY(" + value + "deg)"; document.getElementById('div1').style.transform = "rotateY(" + value + "deg)"; document.getElementById('span1').innerHTML = value + "deg"; } function checkBackface() { if (document.getElementById("bf").checked == true) { document.getElementById('div1').style.webkitBackfaceVisibility = "hidden"; document.getElementById('div1').style.MozBackfaceVisibility = "hidden"; } else { document.getElementById('div1').style.webkitBackfaceVisibility = "visible"; document.getElementById('div1').style.MozBackfaceVisibility = "visible"; } } </script> </head> <body> <div id="div1">HELLO</div> <p>Rotate the yellow div element, with and without checking the backface-visibility checkbox:</p> <p>Hide the backside:<input type="checkbox" onchange="checkBackface()" id="bf" /></p> Rotate:<br> <input type="range" min="-360" max="360" value="25" onchange="rotate(this.value)" /><br> transform: rotateY(<span id="span1">7deg</span>);<br> </body> </html>
运行结果:
点击运行 »