<section class="container container-1">
<code>50% 50%</code>
<div class="cube">
<div class="front">1</div>
<div class="back">2</div>
<div class="right">3</div>
<div class="left">4</div>
<div class="top">5</div>
<div class="bottom">6</div>
</div>
</section>
<section class="container container-2">
<code>top left</code>
<div class="cube">
<div class="front">1</div>
<div class="back">2</div>
<div class="right">3</div>
<div class="left">4</div>
<div class="top">5</div>
<div class="bottom">6</div>
</div>
</section>
<section class="container container-3">
<code>top</code>
<div class="cube">
<div class="front">1</div>
<div class="back">2</div>
<div class="right">3</div>
<div class="left">4</div>
<div class="top">5</div>
<div class="bottom">6</div>
</div>
</section>
<section class="container container-4">
<code>top right</code>
<div class="cube">
<div class="front">1</div>
<div class="back">2</div>
<div class="right">3</div>
<div class="left">4</div>
<div class="top">5</div>
<div class="bottom">6</div>
</div>
</section>
<section class="container container-5">
<code>right</code>
<div class="cube">
<div class="front">1</div>
<div class="back">2</div>
<div class="right">3</div>
<div class="left">4</div>
<div class="top">5</div>
<div class="bottom">6</div>
</div>
</section>
<section class="container container-6">
<code>bottom right</code>
<div class="cube">
<div class="front">1</div>
<div class="back">2</div>
<div class="right">3</div>
<div class="left">4</div>
<div class="top">5</div>
<div class="bottom">6</div>
</div>
</section>
<section class="container container-7">
<code>bottom</code>
<div class="cube">
<div class="front">1</div>
<div class="back">2</div>
<div class="right">3</div>
<div class="left">4</div>
<div class="top">5</div>
<div class="bottom">6</div>
</div>
</section>
<section class="container container-8">
<code>bottom left</code>
<div class="cube">
<div class="front">1</div>
<div class="back">2</div>
<div class="right">3</div>
<div class="left">4</div>
<div class="top">5</div>
<div class="bottom">6</div>
</div>
</section>
<section class="container container-9">
<code>left</code>
<div class="cube">
<div class="front">1</div>
<div class="back">2</div>
<div class="right">3</div>
<div class="left">4</div>
<div class="top">5</div>
<div class="bottom">6</div>
</div>
</section>
<section class="container container-10">
<code>75% 75%</code>
<div class="cube">
<div class="front">1</div>
<div class="back">2</div>
<div class="right">3</div>
<div class="left">4</div>
<div class="top">5</div>
<div class="bottom">6</div>
</div>
</section>
<section class="container container-11">
<code>10% 30%</code>
<div class="cube">
<div class="front">1</div>
<div class="back">2</div>
<div class="right">3</div>
<div class="left">4</div>
<div class="top">5</div>
<div class="bottom">6</div>
</div>
</section>
* {
box-sizing: border-box;
}
body {
color: #555;
max-width: 1000px;
margin: 0 auto;
font-size: 1.1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
code {
position: relative;
top: -20px;
font-size: 1.5em;
font-weight: bold;
}
.container {
width: 150px;
height: 150px;
margin: 50px;
position: relative;
display: inline-block;
-webkit-perspective: 300px;
perspective: 300px;
}
.cube {
width: 100%;
height: 100%;
position: absolute;
-webkit-transform: translateZ( -100px);
transform: translateZ( -100px);
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.cube div {
width: 150px;
height: 150px;
display: block;
position: absolute;
border: 2px solid black;
background-color: purple;
background-color: rgba(200, 0, 250, .5);
text-align: center;
color: white;
font-size: 25px;
line-height: 200px;
}
.cube .front {
-webkit-transform: rotateY( 0deg) translateZ( 75px);
transform: rotateY( 0deg) translateZ( 75px);
}
.cube .back {
-webkit-transform: rotateX( 180deg) translateZ( 75px);
transform: rotateX( 180deg) translateZ( 75px);
}
.cube .right {
-webkit-transform: rotateY( 90deg) translateZ( 75px);
transform: rotateY( 90deg) translateZ( 75px);
}
.cube .left {
-webkit-transform: rotateY( -90deg) translateZ( 75px);
transform: rotateY( -90deg) translateZ( 75px);
}
.cube .top {
-webkit-transform: rotateX( 90deg) translateZ( 75px);
transform: rotateX( 90deg) translateZ( 75px);
}
.cube .bottom {
-webkit-transform: rotateX( -90deg) translateZ( 75px);
transform: rotateX( -90deg) translateZ( 75px);
}
.container-1 {
-webkit-perspective-origin: 50% 50%;
perspective-origin: 50% 50%;
}
.container-2 {
-webkit-perspective-origin: top left;
perspective-origin: top left;
}
.container-3 {
-webkit-perspective-origin: top;
perspective-origin: top;
}
.container-4 {
-webkit-perspective-origin: top right;
perspective-origin: top right;
}
.container-5 {
-webkit-perspective-origin: right;
perspective-origin: right;
}
.container-6 {
-webkit-perspective-origin: bottom right;
perspective-origin: bottom right;
}
.container-7 {
-webkit-perspective-origin: bottom;
perspective-origin: bottom;
}
.container-8 {
-webkit-perspective-origin: bottom left;
perspective-origin: bottom left;
}
.container-9 {
-webkit-perspective-origin: left;
perspective-origin: left;
}
.container-10 {
-webkit-perspective-origin: 75% 75%;
perspective-origin: 75% 75%;
}
.container-11 {
-webkit-perspective-origin: 10% 30%;
perspective-origin: 10% 30%;
}