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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                .watermelon
  .front
    .right
      .green
      .pink
    .back
      .green
      .pink
    .left
      .green
      .pink
    .top 
    .bottom
    .green
    .pink
    .eye.eye-l
    .eye.eye-r
    .hat
              
            
!

CSS

              
                // watermelon sizes

$watermelon-width: 12em
$watermelon-height: 12em
$watermelon-depth: 4em

// watermelon colors

$watermelon-red: #e7404c
$watermelon-pink: rgb(255,198,184)
$watermelon-green: rgb(42,132,58)
$watermelon-black: #1a1a1a

// simple reset

*
  margin: 0
  padding: 0

// box sizing reset

html
  box-sizing: border-box
  
*, *:before, *:after
  box-sizing: inherit

// styles

html
  height: 100%
  
body
  height: 100%
  display: flex
  justify-content: center
  align-items: center
  background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/226042/water.svg) center 0px lighten($watermelon-red,8%)
  animation: bg 1.5s linear infinite
  
.watermelon
  perspective: 1000px
  
.front
  width: $watermelon-width
  height: $watermelon-height
  position: relative
  transform-style: preserve-3d
  transform: rotate3d(1, 0, 0, 0deg) rotate3d(0, 1, 0, -40deg) rotate3d(0, 0, 1, -20deg)
  background: $watermelon-red
  animation: flip 8s linear infinite
  
.hat
  width: $watermelon-width
  height: $watermelon-depth/2
  position: absolute
  transform: translateY(2em) rotateX(90deg) translateY(1em)
  background: $watermelon-green
  
.right
  width: $watermelon-depth
  height: $watermelon-height
  position: absolute
  transform: translateX($watermelon-width - ($watermelon-depth/2)) rotateY(90deg) translateX($watermelon-depth/2)
  background: darken($watermelon-red,2%)
  
.left
  width: $watermelon-depth
  height: $watermelon-height
  position: absolute
  transform: translateX(-$watermelon-depth/2) rotateY(90deg) translateX($watermelon-depth/2)
  background: darken($watermelon-red,2%)
  
.back
  width: $watermelon-width
  height: $watermelon-height
  position: absolute
  transform: translateZ(-$watermelon-depth)
  background: $watermelon-red
  
.top
  width: $watermelon-width
  height: $watermelon-depth
  position: absolute
  transform: translateY(-$watermelon-depth/2) rotateX(90deg) translateY(-$watermelon-depth/2)
  background: darken($watermelon-green,4%)
  
.bottom
  width: $watermelon-width
  height: $watermelon-depth
  position: absolute
  transform: translateY($watermelon-height -($watermelon-depth/2)) rotateX(90deg) translateY(-$watermelon-depth/2)
  background: darken($watermelon-red,4%)
  
.green
  width: 100%
  height: 1em
  position: absolute
  background: $watermelon-green
  
.pink
  width: 100%
  height: 2em
  position: absolute
  top: 1em
  background: $watermelon-pink
  
.left .pink, .right .pink
  background: darken($watermelon-pink,2%)
.left .green, .right .green
  background: darken($watermelon-green,2%)

.eye
  width: 1em
  height: 1em
  position: absolute
  border-radius: 100%
  background: $watermelon-black
  
.eye-l
  top: 5em
  left: 2em
  
.eye-r
  top: 5em
  right: 2em
  
@keyframes flip
  0% 
    transform: rotate3d(1, 0, 0, 0deg) rotate3d(0, 1, 0, -40deg) rotate3d(0, 0, 1, -20deg)
  100% 
    transform: rotate3d(1, 0, 0, -360deg) rotate3d(0, 1, 0, -40deg) rotate3d(0, 0, 1, -20deg)
  
@keyframes bg
  0% 
    background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/226042/water.svg) center 0px lighten($watermelon-red,8%)
  100% 
    background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/226042/water.svg) center -100px lighten($watermelon-red,8%)
              
            
!

JS

              
                
              
            
!
999px

Console