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

              
                    <div class="container">
      <div class="doll">
        <div class="hair">
          <div></div>
          <div></div>
        </div>
        <div class="face"></div>
        <div class="ear left"></div>
        <div class="ear right"></div>
        <div class="eye left"></div>
        <div class="eye right"></div>
        <div class="nose"></div>
        <div class="mouth"></div>
        <div class="body"></div>
        <div class="arm left">
          <div class="hand"></div>
        </div>
        <div class="arm right">
          <div class="hand"></div>
        </div>
      </div>
      <div class="spring">
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
      </div>
      <div class="box"></div>
    </div>
              
            
!

CSS

              
                $spring: #d2dae2;
$spring2: #808e9b;
$box: #afbdbe;
$body: #8fdaed;
$body2: rgb(78, 110, 119);

$face: #fffdee;
$face2: #d3d3d3;
$nose: #d91e1e;
$hair: #d91e1e;
$eye: #1e272e;
$mouth: #ff3f34;
$bg: #3d3133;

.container,
.spring,
.box,
.body,
.arm,
.face,
.ear,
.nose,
.mouth,
.eye,
.hair {
  position: absolute;
}

body {
  background: $bg;
}

.container {
  margin: auto;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100px;
  height: 300px;
  transform: scale(0.6);
}

.hair {
  z-index: 5;
  width: 200px;
  height: 200px;
  top: -60px;
  position: relative;

  div,
  div:before,
  div:after {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 100%;
    background: $hair;
  }

  div:before,
  div:after {
    content: "";
  }

  div:nth-child(1) {
    top: 60px;
    left: -20px;
    &:before {
      top: -40px;
      left: 20px;
    }
    &:after {
      top: -60px;
      left: 55px;
    }
  }
  div:nth-child(2) {
    top: 60px;
    right: -20px;
    &:before {
      top: -40px;
      right: 20px;
    }
    &:after {
      top: -60px;
      right: 55px;
    }
  }
}

.body {
  z-index: 5;
  border-bottom: 100px solid $body;
  border-left: 25px solid transparent;
  border-right: 25px solid transparent;
  height: 0;
  width: 100px;
  top: 120px;
  left: 25px;
  border-radius: 10px;
  &:before {
    position: absolute;
    content: "";
    left: -24px;
    width: 148px;
    height: 25px;
    background: $body2;
    border-radius: 100%;
    top: 82px;
  }
}

.arm {
  z-index: 4;
  border-bottom: 100px solid $body;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  height: 0;
  width: 20px;
  top: 140px;

  &.left {
    transform-origin: top;
    transform: rotate(90deg);
    left: 40px;
    border-radius: 5px 0px;
    animation: 2.5s arm-move ease-in-out infinite alternate;
  }
  &.left:before {
    content: "";
    position: absolute;
    top: 94px;
    left: -20px;
    width: 60px;
    height: 10px;
    background: $body2;
    border-radius: 40%;
  }

  &.right {
    transform-origin: top;
    transform: rotate(-90deg);
    left: 100px;
    border-radius: 0px 5px;
    animation: 2.5s arm-move2 ease-in-out infinite alternate;
  }

  &.right:before {
    content: "";
    position: absolute;
    top: 94px;
    left: -20px;
    width: 60px;
    height: 10px;
    background: $body2;
    border-radius: 40%;
  }

  .hand {
    width: 25px;
    height: 20px;
    background-color: $face2;
    position: absolute;
    top: 98px;
    left: -10px;
    border-radius: 4px 6px 0 0;

    &:before {
      position: absolute;
      content: "";
      width: 30px;
      height: 50px;
      background-color: $face;
      top: 6px;
      left: -1px;
      border-radius: 20px 40px 40px 25px;
      transform-origin: top;
      transform: rotate(10deg);
    }
    &:after {
      position: absolute;
      content: "";
      width: 10px;
      height: 30px;
      background-color: $face;
      top: 10px;
      left: 0px;
      border-radius: 10px;
      transform-origin: top;
      transform: rotate(46deg);
    }
  }

  &.right .hand {
    transform: scaleX(-1);
    filter: FlipH();
    top: 98px;
    left: 4px;
  }
}

@keyframes arm-move {
  0% {
    transform: rotate(90deg);
  }

  100% {
    transform: rotate(110deg);
  }
}

@keyframes arm-move2 {
  0% {
    transform: rotate(-90deg);
  }

  100% {
    transform: rotate(-110deg);
  }
}

.spring {
  bottom: 0px;
  left: 50px;
  z-index: 4;
}

.spring div {
  width: 100px;
  height: 6px;
  background: $spring2;
  border-radius: 20%;
  margin-top: 4px;
  position: relative;
  animation: 2.5s spring-move ease-in-out infinite alternate;
  transform-origin: left;

  &:before {
    position: absolute;
    content: "";
    width: 100px;
    height: 6px;
    border-radius: 20%;
    background: $spring;
    transform: rotate(-5deg);
    transform-origin: right;
    animation: 2.5s spring-move2 ease-in-out infinite alternate;
  }
}

@keyframes spring-move {
  0% {
    margin-top: 4px;
    width: 100px;
    transform: rotate(0deg);
  }

  100% {
    margin-top: 14px;
    width: 110px;
    transform: rotate(5deg);
  }
}

@keyframes spring-move2 {
  0% {
    width: 100px;
    transform: rotate(-5deg);
  }

  100% {
    width: 110px;
    transform: rotate(-10deg);
  }
}

.doll {
  animation: 2.5s doll-move ease-in-out infinite alternate;
  transform: translateY(0px);
}
@keyframes doll-move {
  0% {
    transform: translateY(0px);
  }

  100% {
    transform: translateY(-80px);
  }
}

.box {
  z-index: 5;
  width: 200px;
  height: 200px;
  background: $box;
  top: 300px;
  border-radius: 2px;

  &:before {
    position: absolute;
    content: "";
    width: 100px;
    height: 4px;
    background: $box;
    left: -99px;
    transform-origin: right;
    transform: rotate(-50deg);
  }
  &:after {
    position: absolute;
    content: "";
    width: 100px;
    height: 4px;
    background: $box;
    right: -99px;
    transform-origin: left;
    transform: rotate(50deg);
  }
}

.face {
  z-index: 6;
  background: $face;
  width: 150px;
  height: 150px;
  top: 0px;
  left: 25px;

  border-radius: 100%;
}

.ear {
  z-index: 5;
  background: $face2;
  width: 50px;
  height: 50px;
  border-radius: 100%;
  border-left: 6px solid $face;
  border-top: 6px solid $face;
  top: 50px;
  animation: 2.5s ear-move ease-in-out infinite alternate;

  &.left {
    left: 0;
    transform: rotate(-45deg);
  }

  &.right {
    left: 140px;
    transform: rotate(135deg);
  }
}

@keyframes ear-move {
  0% {
    top: 50px;
  }

  100% {
    top: 60px;
  }
}

.eye {
  z-index: 7;
  background: $eye;
  width: 20px;
  height: 50px;
  border-radius: 100%;
  top: 20px;

  &:before {
    position: absolute;
    content: "";
    width: 0;
    height: 0;
    top: 15px;
    left: 4px;
    border-top: 10px solid transparent;
    border-right: 20px solid #fff;
    border-bottom: 10px solid transparent;
    animation: 2.5s eye-move ease-in-out infinite alternate;
  }

  &.left {
    left: 60px;
  }

  &.right {
    left: 120px;
  }
}

@keyframes eye-move {
  0% {
    top: 15px;
  }

  100% {
    top: 20px;
  }
}

.nose {
  z-index: 7;
  background: $nose;
  width: 50px;
  height: 40px;
  border-radius: 100%;
  top: 50px;
  left: 76px;
}

.mouth {
  z-index: 6;
  background: $mouth;
  width: 40px;
  height: 1px;
  border-radius: 100%;
  border: 1px solid $face;
  top: 100px;
  left: 80px;
  animation: 2.5s mouth-move ease-in-out infinite alternate;
}
@keyframes mouth-move {
  0% {
    height: 1px;
  }

  100% {
    height: 20px;
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console