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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

              
                .container
	.cube
		.sides
			.top
			.right
			.bottom
			.left
			.front
			.back
              
            
!

CSS

              
                // Originally Designed by Danny Ruchtie --> https://twitter.com/druchtie

// try any color 
color = white

:root
	// play around with these values to get different effects
	--size 20vmin
	--border-width-fraction: 50
	--border-radius-fraction 12
	--timing: ease
	--duration: 3s
	--delay: 100ms

	--f: rotateY(0deg)
	--b: rotateY(-180deg)
	--l: rotateY(-90deg)
	--bt rotateX(-90deg)
	--r rotateY(90deg)
	--t rotateX(90deg)
	--z1: translateZ(var(--size))
	--z2: translateZ(calc(var(--size)/2))
	--z0: translateZ(calc(1.041*var(--size)))
	
	

body
	min-height: 100vh
	background: darken(color, 90%)
	display: grid 
	place-items: center 
	overflow hidden
	
*
	box-sizing: border-box
	
.container
	position relative
	
.cube 
	transform translate(-50%, -50%)
	
.cube, .cube * 
	width: var(--size)
	height: var(--size)
	position absolute


.sides
	animation: rotate var(--duration) 0.8s var(--timing) infinite
	transform-style: preserve-3d
	transform: rotateX(-37.5deg) rotateY(45deg)
	& *
		border: calc( var(--size) / var(--border-width-fraction) ) solid 
		border-color: color
		border-radius: calc( var(--size) / var(--border-radius-fraction) )
		background: rgba(color, 0.1)
		transform-origin: 50% 50%
		animation-fill-mode: forwards
		
		

.right 
	animation: right var(--duration) var(--delay) var(--timing) infinite	
.bottom 
	animation: bottom var(--duration) 0ms var(--timing) infinite
.left 
	animation: left var(--duration) var(--delay) var(--timing) infinite	
.front
	animation: front var(--duration) var(--delay) var(--timing) infinite
.back
	animation: back var(--duration) var(--delay) var(--timing) infinite
.top
	animation: top var(--duration) 0ms var(--timing) infinite
	

@keyframes back
	0%
		transform var(--b) var(--z1)
	20%
		transform var(--b) var(--z2)
	70%
		transform var(--b) var(--z2)
	90%
		transform var(--b) var(--z1)
	100%
		transform var(--b) var(--z1)
		

@keyframes front
	0%
		transform: var(--f) var(--z1)
	20%
		transform: var(--f) var(--z2)
	70% 
		transform: var(--f) var(--z2)
	90% 
		transform: var(--f) var(--z1)
	100% 
		transform: var(--f) var(--z1)
		
		
		
@keyframes left
	0%
		transform: var(--l) var(--z1)
	20% 
		transform: var(--l) var(--z2)
	70% 
		transform: var(--l) var(--z2)
	90%
		transform: var(--l) var(--z1)
	100% 
		transform: var(--l) var(--z1)
		

@keyframes bottom 
	0%
		transform: var(--bt) var(--z0)
	20%
		transform: var(--bt) var(--z2)
	70%
		transform: var(--bt) var(--z2)
	90%
		transform: var(--bt) var(--z0)
	100% 
		transform: var(--bt) var(--z0)
		
		
@keyframes right 
	0%
		transform: var(--r) var(--z1)
	20%
		transform: var(--r) var(--z2)
	70%
		transform: var(--r) var(--z2)
	90%
		transform: var(--r) var(--z1)
	100%
		transform: var(--r) var(--z1)

@keyframes top 
	0%
		transform: var(--t) var(--z0)
	20%
		transform: var(--t) var(--z2)
	70%
		transform: var(--t) var(--z2)
	90%
		transform: var(--t) var(--z0)
	100%
		transform: var(--t) var(--z0)
		
@keyframes rotate
	0%
		transform: rotateX(-37.5deg) rotateY(45deg)
	50%
		transform: rotateX(-37.5deg) rotateY(405deg)
	100%
		transform: rotateX(-37.5deg) rotateY(405deg)
		
              
            
!

JS

              
                
              
            
!
999px

Console