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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

            
              <body>
  <h1>Oh wow, that's a real CSS Cat!</h1>
  <div class="cat">
    <div class="left-ear ear"></div>
    <div class="right-ear ear"></div>
    <div class="cat-head">
      <div class="left-eye eye open-eye">
        <div class="iris">
          <div class="pupil"></div>
        </div>
      </div>
      <div class="right-eye eye open-eye">
        <div class="iris">
          <div class="pupil"></div>
        </div>
      </div>
      <div class="nose"></div>
      <div class="muzzle"></div>
      <div class="whiskers">
        <div class="whiskers-left">
          <div class="whisker"></div>
          <div class="whisker"></div>
          <div class="whisker"></div>
        </div>
        <div class="whiskers-right">
          <div class="whisker"></div>
          <div class="whisker"></div>
          <div class="whisker"></div>
        </div>
      </div>
    </div>
    <div class="cat-body">
    </div>
    <div class="left-paw paw"></div>
    <div class="right-paw paw"></div>
  </div>
  <div class="say-hi">
    <p>Say hi!</p>
    <button id="hi-button">Hi CSS Cat!</button>
  </div>
</body>
            
          
!
            
              //colors
$fur-color : #4E3822;
$eye-color : #16DB65;
$dark-color : #1C1C1C;
$light-color : #fafafa;
$background-color : #85C7F2;
$tongue-color : #F3B3A6;

//fonts
$heading-font : Arima Madurai;
$font : Lato;

//breakpoints
$bp-small : 24em;
$bp-medium : 46.8em;
$bp-large : 50em;

//keyframes
//hi
@-webkit-keyframes hi-body {
  0% {
    top:70px;
  }
  60% {
    top:68px;
  }
  100% {
    top:70px;
  }
}
@-moz-keyframes hi-body {
  0% {
    top:70px;
  }
  60% {
    top:68px;
  }
  100% {
    top:70px;
  }
}
@keyframes hi-body {
  0% {
    top:70px;
  }
  50% {
    top:68px;
  }
  100% {
    top:70px;
  }
}
@-webkit-keyframes hi-left-paw {
  0% {
    bottom:-3px;
  }
  15% {
    bottom:0px;
  }
  50% {
    bottom:0px;
  }
  65% {
    bottom:-3px;
  }
  100% {
    bottom:-3px;
  }
}
@-moz-keyframes hi-left-paw {
  0% {
    bottom:-3px;
  }
  15% {
    bottom:0px;
  }
  50% {
    bottom:0px;
  }
  65% {
    bottom:-3px;
  }
  100% {
    bottom:-3px;
  }
}
@keyframes hi-left-paw {
  0% {
    bottom:-3px;
  }
  15% {
    bottom:0px;
  }
  50% {
    bottom:0px;
    }
  65% {
    bottom:-3px;
  }
  100% {
    bottom:-3px;
  }
}
@-webkit-keyframes hi-right-paw {
  0% {
    bottom:-3px;
  }
  15% {
    bottom:-3px;
  }
  30% {
    bottom:0px;
  }
  65% {
    bottom:0px;
  }
  80% {
    bottom:-3px;
  }
  100% {
    bottom:-3px;
  }
}
@-moz-keyframes hi-right-paw {
  0% {
    bottom:-3px;
  }
  15% {
    bottom:-3px;
  }
  30% {
    bottom:0px;
  }
  65% {
    bottom:0px;
  }
  80% {
    bottom:-3px;
  }
  100% {
    bottom:-3px;
  }
}
@keyframes hi-right-paw {
  0% {
    bottom:-3px;
  }
  15% {
    bottom:-3px;
  }
  30% {
    bottom:0px;
  }
  65% {
    bottom:0px;
  }
  80% {
    bottom:-3px;
  }
  100% {
    bottom:-3px;
  }
}

body {
  margin: 0;
  padding: 0;
  background-color:$background-color;
  overflow-x:hidden;
}
h1 {
  margin:0;
  padding:0.5em 0;
  width:100%;
  text-align:center;
  font-family:$heading-font;
  font-weight:200;
  font-size:1.5rem;
  color:$dark-color;
  @media screen and (min-width: $bp-medium) {
    font-size:2.5rem;
  }
  @media screen and (min-width: $bp-large) {
    font-size:3rem;
  }
}
.cat {
  position:absolute;
  left:50%;
  -webkit-transform:
    translateX(-50%);
  -moz-transform:
    translateX(-50%);
  transform:
    translateX(-50%);
  cursor:pointer;
  height:273px;
}

.cat-head {
  position:absolute;
  left:50%;
  -webkit-transform:
    translateX(-50%);
  -moz-transform:
    translateX(-50%);
  transform:
    translateX(-50%);
  z-index:5;
  width:200px;
  height:180px;
  background-color:$fur-color;
  border-radius:44%;
  border:solid 1px $dark-color;
}
.ear {
  background-color:$fur-color;
  width:100px;
  height:100px;
  border:solid 1px $dark-color;
}
.left-ear {
  position:absolute;
  left:50%;
  -webkit-transform:
    translateX(-100px);
  -moz-transform:
    translateX(-100px);
  transform:
    translateX(-100px);
  z-index:4;
  border-radius:4px 80px;
}
.right-ear {
  position:absolute;
  left:50%;
  z-index:4;
  border-radius:80px 4px;
}
.large-pupil {
  width:38px !important;
}
.eye.closed-eye {
  //transitions for eye closing
   -webkit-transition: 
     width 0.3s linear, 
     height 0.15s linear, 
     transform 0.15s linear, 
     background-color 0.15s linear;
   -moz-transition: 
     width 0.3s linear, 
     height 0.15s linear, 
     transform 0.15s linear, 
     background-color 0.15s linear;
  transition: 
    width 0.3s linear, 
    height 0.15s linear, 
    transform 0.15s linear, 
    background-color 0.15s linear;
  
  height:1px; 
  background-color:$dark-color;
  
  // left eye when closed
  &.left-eye {
    -webkit-transform:
      translateX(-140%)
      translateY(25px)
      rotate(25deg);
    -moz-transform:
      translateX(-140%)
      translateY(25px)
      rotate(25deg);
    transform:
      translateX(-140%)
      translateY(25px)
      rotate(25deg);
  }
  
  //right eye when closed
  &.right-eye {
    -webkit-transform:
      translateX(40%)
      translateY(25px)
      rotate(-25deg);
    -moz-transform:
      translateX(40%)
      translateY(25px)
      rotate(-25deg);
    transform:
      translateX(40%)
      translateY(25px)
      rotate(-25deg);
  }
  
  //irises when eyes are closed
  .iris {
    height:0;
    
    //paralel to the eye
    -webkit-transform:
      rotate(0deg);
    -moz-transform:
      rotate(0deg);
    transform:
      rotate(0deg);
    
    //transitions for eye closing
    -webkit-transition: 
      height 0.1s linear, 
      transform 0.05s linear;
    -moz-transition: 
      height 0.1s linear, 
      transform 0.05s linear;
    transition: 
      height 0.1s linear, 
      transform 0.05s linear;
    
    //pupils for closed eyes
    .pupil {
      height:0;
      
      //transitions for closing eye
      -webkit-transition: 
        height 0.1s linear;
      -moz-transition: 
        height 0.1s linear;
      transition: 
        height 0.1s linear;
      
      //pupil's light while closing eye
      &:after {
        opacity:0;
      }
    }
  }
}

//eye properties
.eye {
  position:absolute;
  top:50px;
  left:50%;
  border: solid 2px $dark-color;
  width:46px;
  
  //iris properties
  .iris {
    position:absolute;
    width:46px;
    background-color:$eye-color;
    border-radius:50%;
    box-shadow: inset 0 0 10px #0b6d33;
    
    //pupil properties
    .pupil {
      margin: 4px auto;
      width:16px;
      background-color:$dark-color;
      border-radius:50%;
      box-shadow: inset 0 0 4px #0a0a0a, 0 0 4px #8bedb3;
      
      //pupils light properties
      &:after {
        content:"";
        display:block;
        width:4px;
        height:4px;
        background-color:$light-color;
        margin:0 auto;
        position:relative;
        top:2px;
        left:2px;
        border-radius:50%;
        box-shadow: 0 0 1px $light-color;
      }
    }
  }
}

//open eye's properties
.eye.open-eye {
  
  //transitions for eye opening
  -webkit-transition: 
    width 0.1s linear, 
    height 0.15s linear, 
    transform 0.15s linear, 
    background-color 0.1s linear;
  -moz-transition: 
    width 0.1s linear, 
    height 0.15s linear, 
    transform 0.15s linear, 
    background-color 0.1s linear;
  transition: 
    width 0.1s linear, 
    height 0.15s linear, 
    transform 0.15s linear, 
    background-color 0.1s linear;
  
  height:46px;
  background-color:$light-color;
  
  //iris while eye is open
  .iris {
    -webkit-transition: 
      all 0.15s linear;
    -moz-transition: 
      all 0.15s linear;
    transition: 
      all 0.15s linear;
    height:46px;
    
    //pupil while open eye
    .pupil {
      height:38px;
      -webkit-transition: 
        width 0.5s linear, 
        height 0.15s linear;
      -moz-transition: 
        width 0.5s linear, 
        height 0.15s linear;
      transition: 
        width 0.5s linear, 
        height 0.15s linear;
      
      //pupil's light while open eye
      &:after {
        opacity:1;
        -webkit-transition: 
          opacity 0.5s linear;
        -moz-transition: 
          opacity 0.5s linear;
        transition: 
          opacity 0.5s linear;
      }
    }
  }
}

//left eye's properties
.left-eye {
  -webkit-transform:
    translateX(-140%)
    rotate(-15deg);
  -moz-transform:
    translateX(-140%)
    rotate(-15deg);
  transform:
    translateX(-140%)
    rotate(-15deg);
  border-radius:40% 50% 20% 50%;
  .iris {
    -webkit-transform:
      rotate(15deg);
    -moz-transform:
      rotate(15deg);
    transform:
      rotate(15deg);
  }
}

//right eye's properties
.right-eye {
  -webkit-transform:
    translateX(40%)
    rotate(15deg);
  -moz-transform:
    translateX(40%)
    rotate(15deg);
  transform:
    translateX(40%)
    rotate(15deg);
  border-radius:50% 40% 50% 20%;
  .iris {
    -webkit-transform:
      rotate(-15deg);
    -moz-transform:
      rotate(-15deg);
    transform:
      rotate(-15deg);
  }
}
.nose {
  width:30px;
  height:30px;
  background-color:$dark-color;
  position:absolute;
  z-index:10;
  left:50%;
  top:92px;
  -webkit-transform:
    translateX(-50%)
    rotate(45deg);
  -moz-transform:
    translateX(-50%)
    rotate(45deg);
  transform:
    translateX(-50%)
    rotate(45deg);
  border-radius:100% 5px 20% 5px;
}
.muzzle {
  position:absolute;
  left:50%;
  top:125px;
  z-index:10;
  -webkit-transform:
    translateX(-50%);
  -moz-transform:
    translateX(-50%);
  transform:
    translate(-50%);
  &:before, &:after {
    content:"";
    display:block;
    width:40px;
    height:34px;
    position:absolute;
    z-index:10;
    border-bottom: solid 2px $dark-color;
    border-left: solid 2px $dark-color;
    border-right: solid 2px $dark-color;
    background-color:$fur-color;
  }
  &:before {
    border-radius:50% 0 50% 50%;
    right:50%;
  }
  &:after {
    border-radius:0 50% 50% 50%;
    left:50%;
  }
}
.whiskers {
  width:240px;
  height:70px;
  position:absolute;
  left:-20px;
  top:104px;
  .whiskers-left, .whiskers-right {
    position:absolute;
    width:50%;
    height:100%;
    .whisker {
      width:65%;
      height:20px;
      border-top: solid 2px $dark-color;
    }
  }
  .whiskers-left {
    .whisker {
      border-radius:50% 20%;
      
      //first left whisker
      &:nth-of-type(1) {
        -webkit-transform:
          rotate(10deg);
        -moz-transform:
          rotate(10deg);
        transform:
          rotate(10deg);
      }
      
      //second left
      &:nth-of-type(2) {
        width:70%;
        -webkit-transform:
          translateX(-10px)
          rotate(5deg);
        -moz-transform:
          translateX(-10px)
          rotate(5deg);
        transform:
          translateX(-10px)
          rotate(5deg);
      }
      
      //third left
      &:nth-of-type(3) {
        width:50%;
        -webkit-transform:
          translateX(10px)
          rotate(-8deg);
        -moz-transform:
          translateX(10px)
          rotate(-8deg);
        transform:
          translateX(10px)
          rotate(-8deg);
      }
    }
  }
  .whiskers-right {
    left:50%;
    .whisker {
      float:right;
      border-radius:20% 50%;
      
      //first right whisker
      &:nth-of-type(1) {
        -webkit-transform:
          rotate(-10deg);
        -moz-transform:
          rotate(-10deg);
        transform:
          rotate(-10deg);
      }
      
      //second right
      &:nth-of-type(2) {
        width:70%;
        -webkit-transform:
          translateX(10px)
          rotate(5deg);
        -moz-transform:
          translateX(10px)
          rotate(5deg);
        transform:
          translateX(10px)
          rotate(-5deg);
      }
      
      //third right
      &:nth-of-type(3) {
        width:50%;
        -webkit-transform:
          translateX(-10px)
          rotate(8deg);
        -moz-transform:
          translateX(-10px)
          rotate(8deg);
        transform:
          translateX(-10px)
          rotate(8deg);
      }
    }
  }
}
.cat-body {
  background-color:$fur-color;
  width:230px;
  height:200px;
  position:absolute;
    left:50%;
    top:70px;
  -webkit-transform:
    translateX(-50%);
  -moz-transform:
    translateX(-50%);
  transform:
    translateX(-50%);
  border-radius:44% 44% 30px 30px;
  border:solid 1px $dark-color;
}
.paw {
  background-color:$fur-color;
  width:50px;
  height:30px;
  position:absolute;
  left:50%;
  border: solid 1px $dark-color;
  border-radius:44% 44% 8px 8px;
}
.left-paw {
  position:absolute;
  bottom:-3px;
  -webkit-transform:
    translateX(-125%);
  -moz-transform:
    translateX(-125%);
  transform:
    translateX(-125%);
}
.right-paw {
  position:absolute;
  bottom:-3px;
  -webkit-transform:
    translateX(25%);
  -moz-transform:
    translateX(25%);
  transform:
    translateX(25%);
}
.say-hi {
  position:absolute;
  top:340px;
  left:50%;
  -webkit-transform:
    translateX(-50%);
  -moz-transform:
    translateX(-50%);
  transform:
    translateX(-50%);
  width:400px;
  height:200px;

  p {
    font-family:$font;
    font-weight:300;
    font-size:1.2rem;
    color:$dark-color;
    text-align:center;
  }
  #hi-button {
    display:block;
    position:relative;
    margin:0 auto 50px auto;
    cursor:pointer;
    text-align:center;
    padding:20px;
    font-family:$font;
    font-weight:300;
    font-size:24px;
    color:$dark-color;
    background-color:$light-color;
    border: none;
    outline:none;
    border-radius:10px;
    -webkit-transition: all 0.2s linear;
    -moz-transition: all 0.2s linear;
    transition: all 0.2s linear;
    &:hover {
      &:after {
        content:"";
        display:block;
        position:absolute;
        right:0;
        bottom:-20px;
        width:30px;
        height:30px;
        background-color:$light-color;
        border-radius:0 0 100% 0;
        -webkit-transition:
          height 1s linear;
        -moz-transition:
          height 1s linear;
        transition:
          height 1s linear;
      }
      color:$eye-color;
    }
  }
  @media screen and (min-width: $bp-medium) {
    top:380px;
    p {
      font-size:2rem;
    }
  }
  @media screen and (min-width: $bp-large) {
    top:390px;
    p {
      font-size:2.5rem;
    }
  }
}
            
          
!
            
              $(document).ready(function(){
  //When mouse enters #hi-button cat paws move and pupils change
  $("#hi-button").mouseenter(function(){
    $(".pupil").addClass("large-pupil");
    $(".cat-body").css(
      {"-webkit-animation":"hi-body 1s linear 5",
       "-moz-keyframes":"hi-body 1s linear 5", 
       "animation":"hi-body 1s linear infinite"
      });
    $(".left-paw").css({
      "-webkit-animation":"hi-left-paw 1s linear 5", 
      "-moz-keyframes":"hi-left-paw 1s linear 5", 
      "animation":"hi-left-paw 1s linear infinite"
    });
    $(".right-paw").css({
      "-webkit-animation":"hi-right-paw 1s linear 5", 
      "-moz-keyframes":"hi-right-paw 1s linear 5", 
      "animation":"hi-right-paw 1s linear infinite"
    });
  });
  $("#hi-button").mouseleave(function(){
    $(".cat-body").css({
      "-webkit-animation":"none",
      "-moz-animation":"none",
      "animation":"none"
    });
    $(".left-paw").css({
      "-webkit-animation":"none",
      "-moz-animation":"none",
      "animation":"none"});
    $(".right-paw").css({
      "-webkit-animation":"none",
      "-moz-animation":"none",
      "animation":"none"
    });
    $(".pupil").removeClass("large-pupil");
  });
  //cat closes eyes when mouse enters head
  $(".cat-head").mouseover(function(){
    $(".eye").removeClass("open-eye");
    $(".eye").addClass("closed-eye");
  });
  //cat opens eyes when mouse leaves head
  $(".cat-head").mouseleave(function(){
    $(".eye").removeClass("closed-eye");
    $(".eye").addClass("open-eye");
  });
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console