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

              
                
              
            
!

CSS

              
                $colors: #BF1E56 #007FB1 #23AC0E

@keyframes climb
  0%
    top: 100%
  100%
    top: -30%

html, body
  height: 100%
  width: 100%
  position: relative
  overflow: hidden
body
  background: linear-gradient(#007FB1, transparent)
.baloon
  position: absolute
  bottom: 0
  opacity: 0.8
  height: 6em
  width: 5.5em
  border-radius: 70% 70% 70% 70% / 70% 70% 90% 90%
  @for $i from 1 through 3
    &.baloon#{$i}
      animation: climb #{10 + ($i * 5)}s ease-in forwards
      $color: nth($colors, $i)
      background: $color
      box-shadow: 0 0 0.1em 0.1em $color
      &:before, &:after
        content: ''
        position: absolute
        top: 100%
        left: 50%
        transform: translateX(-50%)
        display: inline-block
      &:before
        $size: 0.5em
        width: $size
        height: 0
        border-radius: $size * 3
        border-style: solid
        border-width: 0 ($size * 2) ($size * 2) ($size * 2)
        border-color: transparent transparent $color transparent
      &:after
        background: #D8E212
        width: 1em
        height: 0.2em
              
            
!

JS

              
                $('html').css({"font-size": (25 * (window.innerWidth * window.innerHeight / (1920 * 1080))) + "px"})
var i = 0;
var intervalMilli = 1000;
var addBaloon = function(){
  i++;
  var baloon = $('<div>').addClass('baloon baloon' + (i % 3 + 1));
  $('body').append(baloon);
  baloon.css({
    left: Math.random() * window.innerWidth,
    transform: 'scale(' + (0.7 + Math.random() * 0.7) + ')',
    'animation-duration': 15 + (Math.random() * 10) + "s"
  })
  var counter = 0;
  var initialSpeed = 0.1
  var speed = initialSpeed;
  if(Math.random() < 0.5){
    speed = -initialSpeed;
  }
  setInterval(function(){
    counter++;
    if(counter % 300 == 0){
      if(Math.random() < 0.5){
        speed = -speed;
      }
    }
    var left = parseFloat(baloon.css('left'));
    left += speed;
    baloon.css({left: left});
  }, 10);
  setTimeout(addBaloon, Math.random() * intervalMilli)
  setTimeout(function(){
    baloon.remove();
  }, 30000);
}

addBaloon();
              
            
!
999px

Console