Skip to content

Instantly share code, notes, and snippets.

@jeremyckahn
Created August 6, 2013 03:56
Show Gist options
  • Select an option

  • Save jeremyckahn/6161884 to your computer and use it in GitHub Desktop.

Select an option

Save jeremyckahn/6161884 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<!-- This is all from http://desandro.github.io/3dtransforms/docs/cube.html -->
<html>
<head>
<style>
.container {
width: 200px;
height: 200px;
position: relative;
-webkit-perspective: 1000px;
}
#cube {
width: 100%;
height: 100%;
position: absolute;
-webkit-transform: translateZ(-100px) rotateY(0deg) rotateX(0deg);
-webkit-transform-style: preserve-3d;
}
#cube figure {
width: 196px;
height: 196px;
display: block;
position: absolute;
border: 2px solid black;
}
#cube .front { -webkit-transform: rotateY( 0deg ) translateZ( 100px ); }
#cube .back { -webkit-transform: rotateX( 180deg ) translateZ( 100px ); }
#cube .right { -webkit-transform: rotateY( 90deg ) translateZ( 100px ); }
#cube .left { -webkit-transform: rotateY( -90deg ) translateZ( 100px ); }
#cube .top { -webkit-transform: rotateX( 90deg ) translateZ( 100px ); }
#cube .bottom { -webkit-transform: rotateX( -90deg ) translateZ( 100px ); }
</style>
</head>
<body>
<section class="container">
<div id="cube">
<figure class="front">1</figure>
<figure class="back">2</figure>
<figure class="right">3</figure>
<figure class="left">4</figure>
<figure class="top">5</figure>
<figure class="bottom">6</figure>
</div>
</section>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment