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

              
                #container
  .face#face1 1
  .face#face2 2
  .face#face3 3
  .face#face4 4
  .face#face5 5
  .face#face6 6

.inputs
  h2 Controls
  .group
    legend X Rotation
    input#x(type="range" min="0" max="360" value="45")
    #xValue 45 degree
  .group
    legend Y Rotation
    input#y(type="range" min="0" max="360" value="45")
    #yValue 45 degree
  .group
    legend Z Rotation
    input#z(type="range" min="0" max="360" value="45")
    #zValue 45 degree
  
              
            
!

CSS

              
                @mixin flex($j: center, $a: center, $d: row)
  display: flex
  justify-content: $j
  align-items: $a
  flex-direction: $d

body 
  width: 100vw
  height: 100vh
  margin: 0
  @include flex($d: column)
  font-family: 'PT Sans', sans-serif

#container 
  position: relative
  width: 100px
  height: 100px
  border-radius: 20px
  background: transparent
  transform: rotateX(45deg) rotateZ(45deg)
  transform-style: preserve-3d
  transform-origin: 50px 50px 0
  .face 
    width: 100px
    height: 100px
    background: #ddd
    position: absolute
    transition: all 0.2s
    backface-visibility: visible
    font-size: 1.2rem
    opacity: 0.8
    @include flex()
  #face1 
    background: green
    transform: translateZ(-50px)
	
  #face2 
    background: red
    transform: translateX(50px) rotateY(90deg)
	
  #face3 
    background: blue
    transform: translateX(-50px) rotateY(90deg)
	
  #face4 
    background: yellow
    transform: translateZ(50px)
	
  #face5 
    background: purple
    transform: translateY(-50px) rotateX(90deg)
	
  #face6 
    background: cyan
    transform: translateY(50px) rotateX(-90deg)

$var1: transparent
$var2: #fff
$var3: #434343
$var4: #43e5f7
$width: 10rem    
    
.inputs
  margin-top: 50px
  text-align: center
  input
    width: $width
    
.group
  margin: 5px
  > div
    margin: 2px
  legend
    font-size: 1.1rem



/*Chrome*/
@media screen and (-webkit-min-device-pixel-ratio:0) 
  input[type='range']
    overflow: hidden
    width: $width
    -webkit-appearance: none
    background-color: $var1
    
    
  input[type='range']::-webkit-slider-runnable-track
    height: 10px
    -webkit-appearance: none
    color: #13bba4
    margin-top: -1px
    
    
  input[type='range']::-webkit-slider-thumb
    width: 10px
    -webkit-appearance: none
    height: 10px
    cursor: ew-resize
    background: $var3
    box-shadow: -80px 0 0 80px $var4
      
/** FF*/
input[type="range"]::-moz-range-progress 
  background-color: $var4

input[type="range"]::-moz-range-track
  background-color: $var1

/* IE*/

input[type="range"]::-ms-fill-lower 
  background-color: $var4

input[type="range"]::-ms-fill-upper 
  background-color: $var1
  
  
#xValue, #yValue, #zValue
  background: #eee
  border-radius: 10px
  @include flex()
  height: 2rem
  width: 10rem
  



              
            
!

JS

              
                const x = document.getElementById('x')
const y = document.getElementById('y');
const z = document.getElementById('z');
const cube = document.getElementById('container');
let values = {x: "45",y: "45", z: "0"};

const changeFunc = (e)=>{
  const currentId = e.target.id;
  values[currentId] = e.target.value;
  let value = `rotateX(${values.x}deg) rotateY(${values.y}deg) rotateZ(${values.z}deg)`;
  cube.style.transform = value;
  document.getElementById(`${currentId}Value`).innerText = `${values[currentId]} degree`;
}
x.addEventListener('input', changeFunc);
y.addEventListener('input', changeFunc);
z.addEventListener('input', changeFunc);
              
            
!
999px

Console