Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html>
<head>
	<title>3D Transform Gallery</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'>
</head>
<body>
	<div class="container">
		<header class="main-header clearfix">
			<h1 class="name">3DTransform <span>Gallery</span></h1>
		</header>

		<div class="content clearfix">

			<div class="cube-container">
				<div class="photo-cube">

					<div class="front cube-number"> <h3>1</h3> </div>
					<div class="back photo-desc">
					  <h3>Earth from Space</h3>
					  <p>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
						<a href="#" class="button">download</a>
					</div>
					<div class="left cube-number"> <h3>2</h3> </div>
					<div class="right cube-number"><h3>3</h3> </div>
          <div class="top cube-number"> <h3>4</h3> </div>
					<div class="bottom cube-number"><h3>5</h3> </div>

				</div>
			</div>	

				<div class="cube-container">
				<div class="photo-cube">

					<div class="front cube-number"> <h3>1</h3> </div>
					<div class="back photo-desc">
					  <h3>Space Images</h3>
					  <p>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
						<a href="#" class="button">download</a>
					</div>
					<div class="left cube-number"> <h3>2</h3> </div>
					<div class="right cube-number"><h3>3</h3> </div>
          <div class="top cube-number"> <h3>4</h3> </div>
					<div class="bottom cube-number"><h3>5</h3> </div>

				</div>
			</div>	

			<div class="cube-container">
				<div class="photo-cube">

					<div class="front cube-number"> <h3>1</h3> </div>
					<div class="back photo-desc">
					  <h3>The Milky Way</h3>
					  <p>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
						<a href="#" class="button">download</a>
					</div>
					<div class="left cube-number"> <h3>2</h3> </div>
					<div class="right cube-number"><h3>3</h3> </div>
          <div class="top cube-number"> <h3>4</h3> </div>
					<div class="bottom cube-number"><h3>5</h3> </div>

				</div>
			</div>	

		</div>
	</div>
</body>
</html>
              
            
!

CSS

              
                /* ================================= 
  Base Element Styles
==================================== */

* {
	box-sizing: border-box;
}
body {
	font: 1em/1.5 'Open Sans', sans-serif;
	color: #373737;
	background: #eaeaea;
	margin: 0;
}
a {
	text-decoration: none;
}
h1,
h2,
h3 {
	text-transform: uppercase;
}
h2 {
	font-size: 1.125em;
	color: #4a89ca;
	font-weight: 600;
	margin: 0;
}
h3 {
	font-size: 1.3em;
	line-height: 1.25em;
	margin-top: .85em;
	margin-bottom: .5em;
}
p {
	font-size: .875em;
	line-height: 1.4;
	margin: 0 0 1.5em;
}

/* ================================= 
  Base Layout Styles
==================================== */

/* ---- Layout Containers ---- */

.container,
.content {
	margin: auto;
}
.container {
	width: 94.02985075%;
	max-width: 1260px;
	padding: 0 2.25em 4em;
	background: #fff;
}
.main-header {
	text-align: center;
	padding: 2.8em 0 3.8em;
}
.cube-container {
	max-width: 200px;
	text-align: center;
	margin: 0 auto 4.5em;
}
/* ---- Page Elements ---- */

.name {
	font-size: 1.65em;
	font-weight: 800;
	margin: 0 0 1.5em;
	line-height: 1;
}
.name span {
	font-weight: 300;
	margin-left: -7px;
}
.logo {
	width: 45px;
	margin-bottom: .4em;
	cursor: pointer;
}
.button {
	font-size: .8em;
	color: #fff;
	width: 90%;
	line-height: 1.15;
	font-weight: 700;
	display: block;
	text-decoration: none;
	text-transform: uppercase;
	padding: .95em 0;
	border-radius: .5em;
	background: rgba(74,137,202, .8);
	margin: auto;
}
/* ---- Photo Overlay ---- */

.photo-desc {
	font-size: .85em;
	color: #fff;
	padding: 1.1em 0.5em 0;
	background: #345d88;
}
/* ---- Float clearfix ---- */

.clearfix::after {
	content: " ";
	display: table;
	clear: both;
}

/* ================================= 
  Square styling
==================================== */

.front {
 background: #000;
}
.left {
 background: #8920F3;
}
.right {
 background: #F32089;
}
.top {
 background: #2089F3;
}
.bottom {
 background: #20F3F3;
}

.front h3 {
 color: #fff;
}
.cube-number {
 font-size: 3em;
}


/* ================================= 
  Media Queries
==================================== */

@media (min-width: 769px) {
	.cube-container {
		float: left;
		margin-left: 16.6%;
	}
}
@media (min-width: 1025px) {
	.cube-container:first-child {
		margin-left: 0;
	}
	.cube-container:last-child{
		float: right;
	}
	.content {
		max-width: 900px;
		margin: auto;
	}
}

/* ================================= 
  Button Transitions
==================================== */

.button {
	-webkit-transition: background .3s;
	transition: background .3s;
}
.button:hover {
	background: rgba(74,137,202, 1);
}





/* ================================= 
  Photo 3D Transforms & Transitions
==================================== */



.cube-container {
	box-shadow: 0 18px 40px 5px rgba(0,0,0,.4);
  -webkit-perspective: 800px;
  perspective: 800px;
  -webkit-transition: box-shadow 2s cubic-bezier(1.000, 0.010, 0.860, 0.040);
  transition: box-shadow 2s cubic-bezier(1.000, 0.010, 0.860, 0.040);
}

.cube-container:hover {
  box-shadow: 0 0 0 0 rgba(0,0,0,0);
  -webkit-transition: box-shadow 0.4s ease-out;
  transition: box-shadow 0.4s ease-out;
}


.photo-cube {
 -webkit-transition: -webkit-transform 2s ease-in-out;
 transition: -webkit-transform 2s ease-in-out;
 transition: transform 2s ease-in-out;
 transition: transform 2s ease-in-out, -webkit-transform 2s ease-in-out;
 width: 200px;
 height: 200px;
 -webkit-transform-style: preserve-3d;
 transform-style: preserve-3d;
}

.photo-cube:hover {
  -webkit-transform: rotateX(360deg) rotateY(-270deg);
  transform: rotateX(360deg) rotateY(-270deg);
}



.front,
.back,
.left,
.right,
.top,
.bottom {
  width: 200px;
  height: 200px;
  display: block;
  position: absolute;
}

.front {
  -webkit-transform: translateZ(100px);
  transform: translateZ(100px);
}

.back {
  -webkit-transform: translateZ(-100px) rotateY(270deg);
  transform: translateZ(-100px) rotateY(270deg);
  -webkit-transform-origin: center left;
  transform-origin: center left;
}

.left {
 -webkit-transform: rotateY(-270deg) translateX(100px);
 transform: rotateY(-270deg) translateX(100px);
 -webkit-transform-origin: top right;
 transform-origin: top right;
}

.right {
  -webkit-transform: translateZ(-100px) rotateY(180deg);
  transform: translateZ(-100px) rotateY(180deg);
}

.top {
  -webkit-transform: rotateX(-270deg) translateY(-100px);
  transform: rotateX(-270deg) translateY(-100px);
 -webkit-transform-origin: top center;
 transform-origin: top center;
}

.bottom {
  -webkit-transform: rotateX(270deg) translateY(100px);
  transform: rotateX(270deg) translateY(100px);
 -webkit-transform-origin: bottom center;
 transform-origin: bottom center;
}


              
            
!

JS

              
                // Created to demonstrate how to add additional top & bottom sides to a cube in a tutoral on 3d transforms & CSS transitions
              
            
!
999px

Console