Created
August 3, 2013 10:07
-
-
Save nDmitry/6145950 to your computer and use it in GitHub Desktop.
CSS3 Cube
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* CSS3 Cube */ | |
| * {box-sizing: border-box;} | |
| body { | |
| background: #000; | |
| } | |
| @keyframes cube { | |
| from { | |
| transform: rotateX(0) rotateY(0); | |
| } | |
| to { | |
| transform: rotateX(360deg) rotateY(360deg); | |
| } | |
| } | |
| .box { | |
| position: absolute; | |
| display: inline-block; | |
| width: 200px; | |
| height: 200px; | |
| top: 50%; | |
| left: 50%; | |
| margin: -100px 0 0 -100px; | |
| transform-style: preserve-3d; | |
| animation: cube 3s linear infinite; | |
| } | |
| .box > div { | |
| position: absolute; | |
| display: table-cell; | |
| width: 200px; | |
| height: 200px; | |
| padding-top: .5em; | |
| background: rgba(102, 102, 0, .6); | |
| border: 1px orange dashed; | |
| color: #fff; | |
| font-size: 6em; | |
| text-align: center; | |
| } | |
| .box__face--top { | |
| transform: translateY(-100px) rotateX(-90deg); | |
| } | |
| .box__face--bottom { | |
| transform: translateY(100px) rotateX(-90deg); | |
| } | |
| .box__face--left { | |
| transform: translateX(-100px) rotateY(-90deg); | |
| } | |
| .box__face--right { | |
| transform: translateX(100px) rotateY(90deg) | |
| } | |
| .box__face--front { | |
| transform: translateZ(-100px); | |
| } | |
| .box__face--back { | |
| transform: translateZ(100px); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="box"> | |
| <div class="box__face--top">1</div> | |
| <div class="box__face--bottom">2</div> | |
| <div class="box__face--left">3</div> | |
| <div class="box__face--right">4</div> | |
| <div class="box__face--front">5</div> | |
| <div class="box__face--back">6</div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // alert('Hello world!'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment