cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              #content
  #click Clique sur Kirby
  %a#kirby
    .eyes.left
    .eyes.right
    .mouth
    .cheeks

 
            
          
!
            
              html, body{width: 100%; height: 100%;}
body{
  background: radial-gradient(#fcd, #dab);
  margin: auto;
}
#content{
  position: absolute;
  width: 50px; height: 50px;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: blue;
}

#kirby{
  display: inline-block;
  position: absolute;
  width: 200px; height: 200px;
  left: 50%; top: 50%;
  border: black 5px solid;
  border-radius: 50%;
  background: #fac;
  transition: all 0.2s;
  transform: translate(-50%, -50%);
  
  .eyes{
    position: absolute;
    width: 18px; height: 50px;
    background: #038;
    border-radius: 50%;
    border: black 5px solid;
    top: 35%;
    transform: translate(-50%, -50%);
    overflow: hidden;
    &.left{
      left: 38%;
    }
    &.right{
      left: 62%;
    }
    &:before{
      content: "";
      position: absolute;
      display: inline-block;
      width: 200%; height: 100%;
      border-radius: 50%;
      top: 25%; left: 50%;
      background: black;
      transform: translate(-50%, -50%);
    }
    &:after{
      content: "";
      position: absolute;
      display: inline-block;
      width: 75%; height: 50%;
      border-radius: 50%;
      top: 25%; left: 50%;
      background: white;
      transform: translate(-50%, -50%);
    }
  }
  .cheeks{
    position: absolute;
    width: 0px; height: 0px;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: blue;
    &:before{
      content: "";
      position: absolute;
      width: 30px; height: 15px;
      left: -50px;
      background: #f8a;
      border-radius: 50%;
      transform: translate(-50%, -50%);
    }
    &:after{
      content: "";
      position: absolute;
      width: 30px; height: 15px;
      left: 50px;
      background: #f8a;
      border-radius: 50%;
      transform: translate(-50%, -50%);
    }
  }
  .mouth{
    position: absolute;
    width: 50px; height: 50px;
    top: 68%; left: 50%;
    border-radius: 10px;
    transform: translate(-50%, -50%);
    overflow: hidden;
    &:before{
      content: "";
      position: absolute;
      background: #611;
      width: 100%; height: 150%;
      left: 50%; top: 0;
      border-radius: 50%;
      transform: translate(-50%, -50%);
    }
    &:after{
      content: "";
      position: absolute;
      background: #d43;
      width: 60%; height: 40%;
      left: 50%; top: 45%;
      border-radius: 50%;
      transform: translate(-50%, -50%);
    }
  }
}
#kirby:active{
  transform: translate(-50%, -50%) scale(0.8);
}
#click{
  position: absolute;
  top: 400%; left: 50%;
  width: 500px;
  text-align: center;
  transform: translate(-50%, -50%) scale(0);
  font: 32px Impact, serif;
  animation: anim2 1s infinite alternate;
}
@keyframes anim2{
  from{transform: translate(-50%, -50%) scale(0.9);}
  to{transform: translate(-50%, -50%) scale(1.1);}
}
#text{
  position: absolute;
  top: 400%; left: 50%;
  width: 500px;
  text-align: center;
  transform: translate(-50%, -50%) scale(1);
  font: 48px Impact, serif;
  animation: apparition 1s, anim2 1s 1s infinite alternate;
}
@keyframes apparition{
  from{transform: translate(-50%, -50%) scale(0); opacity:0;}
  to{transform: translate(-50%, -50%) scale(0.9); opacity:1;}
}
.heart{
  position: absolute;
  width: 50px; height: 50px;
  z-index: 500;
  animation: heartmove 2s forwards;
  .top{
    &:before{
      position: absolute;
      content: "";
      background: red;
      width: 50%; height: 50%;
      border-radius: 50%;
    }
    &:after{
      position: absolute;
      right: 0;
      content: "";
      background: red;
      width: 50%; height: 50%;
      border-radius: 50%;
    }
  }
  .bottom{
    position: absolute;
    top: 25%;
    width: 100%; height: 75%;
    .left{
      position: absolute;
      width: 50%; height: 100%;
      overflow: hidden;
      &:before{
        position: absolute;
        content: "";
        background: red;
        width: 400%; height: 200%;
        border-radius: 50%;
        top: -100%;
      }
    }
    .right{
      position: absolute;
      width: 50%; height: 100%;
      right: 0;
      overflow: hidden;
      &:before{
        position: absolute;
        content: "";
        background: red;
        width: 400%; height: 200%;
        border-radius: 50%;
        top: -100%; right: 0;
      }
    }
  }
}
@keyframes heartmove{
  from{transform: translateY(0); opacity:1;}
  to{transform: translateY(-100px); opacity:0;}
}
            
          
!
            
              var booleen = 1;

$('#kirby').click(function(){
  
  if (booleen){
    $("#click").remove();
    $("<div id='text'>Bonne fête maman !</div>").insertAfter("#kirby");
    booleen = 0;
  }
  
  for(var i = 0; i < 5; i++){
    var x = (Math.random() * 400 - 200) + "px"
    var y = (Math.random() * 200 - 200) + "px"
    $("<div class='heart'><div class='top'></div><div class='bottom'><div class='left'></div><div class='right'></div></div></div>").insertAfter("#kirby").css({'left':x, 'top':y}).one("animationend", function(event){ $(this).remove(); });
  }
});
            
          
!
999px
Loading ..................

Console