<html>
<head>
<style>
#div1
{
position: relative;
height: 200px;
width: 200px;
margin: 50px;
padding:10px;
border: 1px solid black;
}
#div2
{
padding:50px;
position: absolute;
border: 1px solid black;
background-color: red;
transform: rotateY(45deg);
transform-origin:50% 50% 100px;
-webkit-transform: rotateY(70deg); /* Safari and Chrome */
-webkit-transform-origin:50% 50% 100px; /* Safari and Chrome */
-moz-transform: rotateY(70deg); /* Firefox */
-moz-transform-origin:50% 50% 100px; /* Firefox */
-o-transform: rotateY(70deg); /* Opera */
-o-transform-origin:50% 50% 100px; /* Opera */
}
#div3
{
padding:40px;
position: absolute;
border: 1px solid black;
background-color: yellow;
transform: rotateY(80deg);
transform-origin:40% 90% 10px;
-webkit-transform: rotateY(80deg); /* Safari and Chrome */
-webkit-transform-origin:40% 90% 10px; /* Safari and Chrome */
-moz-transform: rotateY(80deg); /* Firefox */
-moz-transform-origin:40% 90% 10px; /* Firefox */
-o-transform: rotateY(80deg); /* Opera */
-o-transform-origin:40% 90% 10px; /* Opera */
}
</style>
<script>
function changeRot(value)
{
document.getElementById('div2').style.transform="rotateY(" + value + "deg)";
document.getElementById('div2').style.webkitTransform="rotateY(" + value + "deg)";
document.getElementById('div2').style.MozTransform="rotateY(" + value + "deg)";
document.getElementById('div2').style.OTransform="rotateY(" + value + "deg)";
document.getElementById('persp').innerHTML=value + "deg";
}
function checkFlat()
{
if (document.getElementById("tf").checked==true)
{
document.getElementById('div2').style.webkitTransformStyle="preserve-3d";
}
else
{
document.getElementById('div2').style.webkitTransformStyle="flat";
}
}
</script>
</head><body>
<p>Rotate the div elements, with and without checking the transform-style checkbox:</p>
<div id="div1">
<div id="div2">HELLO
<div id="div3">YELLOW</div>
</div>
</div>
webkit-transform-style: preserve-3d<input type="checkbox" onchange="checkFlat()" id="tf"><br>
<br>
Rotate:<br>
<input type="range" min="-360" max="360" value="70" onchange="changeRot(this.value)"><br>
-webkit-transform: rotateY:(<span id="persp">70deg</span>);
</body>
</html>