The code is as Follows:
<! DOCTYPE html>
<meta charset= "UTF-8" >
<TITLE>CSS3 Star Rotating Cube </title>
<style type= "text/css" >
body{
Background-image:linear-gradient (to top,blue, #000);
}
*{
padding:0;
margin:0;
}
#Mypage {
/*-webkit-perspective:600px;
-webkit-perspective-origin:50% 50%;*/
-webkit-transform-style:preserve-3d;
position:relative;
width:400px;
height:400px;
margin:100px auto;
}
#Mypage li{
list-style:none;
}
. pages{
position:absolute;
width:400px;
height:400px;
}
#page1 {
Background-color: #FF0088;
-webkit-transform:translatez (200px);
}
#page2 {
Background-color: #FFFF00;
-webkit-transform:rotatex (90deg) Translatez (200px);
}
#page3 {
Background-color: #00FF00;
-webkit-transform:rotatex (270deg) Translatez (200px);
}
#page4 {
Background-color: #00FFFF;
-webkit-transform:rotatey (90deg) Translatez (200px);
}
#page5 {
Background-color: #7700FF;
-webkit-transform:rotatey (270deg) Translatez (200px);
}
#page6 {
Background-color: #FF00FF;
-webkit-transform:translatez ( -200px);
}
#closth {
margin:0 auto;
font-size:18px;
text-align:center;
padding-top:100px;
float:left;
}
#closth div{
padding-top:20px;
margin-bottom:15px;
}
#closth Div a{
Color: #fff;
margin-right:40px;
}
#heard {
width:80%;
margin:0 auto;
margin-bottom:300px;
}
#Opage {
margin-top:20px;
}
. wrap:first-child{
margin-left:400px;
}
. wrap{
float:left;
List-style:none outside none;
padding-right:40px;
}
. Wrap a{
Color: #fff;
}
</style>
<body>
<div id= "heard" >
<div id= "closth" >
<div><a href= "javascript:tops ()" > Rollover </a></div>
<div><a href= "javascript:lefts ()" > Left turn </a><a href= "javascript:cleanth ()" > Reset </a><a href= "javascript:rights ()" > Right Turn </a></div>
<div><a href= "javascript:bottoms ()" > Rollover </a></div>
</div>
<ul id= "mypage" >
<li class= "pages" id= "page1" ></li>
<li class= "pages" id= "page2" ></li>
<li class= "pages" id= "page3" ></li>
<li class= "pages" id= "page4" ></li>
<li class= "pages" id= "page5" ></li>
<li class= "pages" id= "page6" ></li>
</ul>
<ul id= "opage" >
<li class= "wrap" ><a href= "javascript:ones ()" >1</a></li>
<li class= "wrap" ><a href= "javascript:twos ()" >2</a></li>
<li class= "wrap" ><a href= "javascript:threes ()" >3</a></li>
<li class= "wrap" ><a href= "javascript:fours ()" >4</a></li>
<li class= "wrap" ><a href= "javascript:fives ()" >5</a></li>
<li class= "wrap" ><a href= "javascript:sixs ()" >6</a></li>
</ul>
</div>
<script type= "text/javascript" >
var x=0;
var y=0;
var n,m=0;
function Cleanth () {
x=0;
y=0;
n=0;
m=0;
var Curpage=document.getelementbyid (' MyPage ');
curpage.style.transition= '-webkit-transform 20ms Linear ';
curpage.style.transform= "rotatex (" +x+ "deg) rotatey (" +y+ "deg)";
}
function Count () {
If (x%360==0) {
n=x/360;
}
If (y%360==0) {
m=y/360;
}
}
Function Tops ()
{
Count ();
x+=90;
var Curpage=document.getelementbyid (' MyPage ');
curpage.style.transition= '-webkit-transform 3s linear ';
curpage.style.transform= "rotatex (" +x+ "deg) rotatey (" +y+ "deg)";
}
function Bottoms () {
Count ();
x-=90;
var Curpage=document.getelementbyid (' MyPage ');
curpage.style.transition= '-webkit-transform 3s linear ';
curpage.style.transform= "rotatex (" +x+ "deg) rotatey (" +y+ "deg)";
}
Function Lefts () {
Count ();
y+=90;
var Curpage=document.getelementbyid (' MyPage ');
curpage.style.transition= '-webkit-transform 3s linear ';
curpage.style.transform= "rotatex (" +x+ "deg) rotatey (" +y+ "deg)";
}
function Rights () {
Count ();
y-=90;
var Curpage=document.getelementbyid (' MyPage ');
curpage.style.transition= '-webkit-transform 3s linear ';
curpage.style.transform= "rotatex (" +x+ "deg) rotatey (" +y+ "deg)";
}
function Ones () {
Count ();
x=0+n*360;
y=0+m*360;
var Curpage=document.getelementbyid (' MyPage ');
curpage.style.transition= '-webkit-transform 3s linear ';
curpage.style.transform= "rotatex (" +x+ "deg) rotatey (" +y+ "deg)";
}
Function Twos () {
Count ();
x=-90+n*360;
y=m*360+0;
var Curpage=document.getelementbyid (' MyPage ');
curpage.style.transition= '-webkit-transform 3s linear ';
curpage.style.transform= "rotatex (" +x+ "deg) rotatey (" +y+ "deg)";
}
Function Threes () {
Count ();
x=90+n*360;
y=0+m*360;
var Curpage=document.getelementbyid (' MyPage ');
curpage.style.transition= '-webkit-transform 3s linear ';
curpage.style.transform= "rotatex (" +x+ "deg) rotatey (" +y+ "deg)";
}
Function Fours () {
Count ();
x=0+n*360;
y=m*360-90;
var Curpage=document.getelementbyid (' MyPage ');
curpage.style.transition= '-webkit-transform 3s linear ';
curpage.style.transform= "rotatex (" +x+ "deg) rotatey (" +y+ "deg)";
}
Function Fives () {
Count ();
x=0+n*360;
y=90+m*360;
var Curpage=document.getelementbyid (' MyPage ');
curpage.style.transition= '-webkit-transform 3s linear ';
curpage.style.transform= "rotatex (" +x+ "deg) rotatey (" +y+ "deg)";
}
function Sixs () {
Count ();
x=180+n*360;
y=0+m*360;
var Curpage=document.getelementbyid (' MyPage ');
curpage.style.transition= '-webkit-transform 3s linear ';
curpage.style.transform= "rotatex (" +x+ "deg) rotatey (" +y+ "deg)";
}
</script>
</body>
CSS for cube rotation