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 center">

  <div class="row">
    <div class="col-xs-12">
      <div class="circle">

        <div id="sun">
        </div>

        <div id="cloud">
        </div>

        <div class="cat">
          <div class="left-eye">
            <div class="pupil">
              <div class="light"></div>
              <div class="eyelid"></div>
            </div>
          </div>

          <div class="right-eye">
            <div class="pupil">
              <div class="light"></div>
              <div class="eyelid"></div>
            </div>
          </div>

          <div class="mouth"></div>
        </div>

      </div>
    </div>
  </div>

  <div class="row">


    <div class="col-xs-12 centered-text">
      <div class="sun-icon"></div>

      <label class="switch">
                        <input type="checkbox">
                        <div class="slider"></div>
                    </label>

      <div class="cloud-icon"></div>
    </div>


  </div>


</div>
              
            
!

CSS

              
                body {
  background-color: #469CCE;
  transition: background-color 1s linear;
  -webkit-transition: background-color 1s linear;
  -moz-transition: background-color 1s linear;
  -o-transition: background-color 1s linear;
}

.center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.circle {
  position: relative;
  margin: 0 auto;
  margin-bottom: 20px;
  width: 23%;
  min-width: 250px;
  min-height: 250px;
  border-radius: 50%;
  background-color: inherit;
  border: 8px solid white;
  overflow: hidden;
}

.circle:after {
  display: block;
  content: "";
  padding-bottom: 100%;
}


/* THE CAT */

.cat {
  position: absolute;
  bottom: -20px;
  left: 20%;
  height: 55%;
  width: 60%;
  background-color: #E78336;
  border-bottom-style: solid;
  border-bottom-color: #E78336;
  transition: background-color 1s linear, border-bottom-color 1s linear;
  -webkit-transition: background-color 1s linear, border-bottom-color 1s linear;
  -moz-transition: background-color 1s linear, border-bottom-color 1s linear;
  -o-transition: background-color 1s linear, border-bottom-color 1s linear;
  animation: bouncy-cat 2s ease-in-out infinite;
  -webkit-animation: bouncy-cat 2s ease-in-out infinite;
  -moz-animation: bouncy-cat 2s ease-in-out infinite;
  -o-animation: bouncy-cat 2s ease-in-out infinite;
}

.cat:before,
.cat:after {
  position: absolute;
  content: "";
  bottom: 100%;
  border-bottom-style: solid;
  border-bottom-width: 25px;
  border-bottom-color: inherit;
}

.cat:before {
  border-left: 0px solid transparent;
  border-right: 35px solid transparent;
}

.cat:after {
  border-left: 35px solid transparent;
  border-right: 0px solid transparent;
  right: 0;
}

@keyframes bouncy-cat {
  0% {
    bottom: -20px;
  }
  50% {
    bottom: -30px;
  }
  100% {
    bottom: -20px;
  }
}


/* CAT'S EYES */

.left-eye,
.right-eye {
  position: absolute;
  top: 15%;
  width: 30%;
  height: auto;
  padding-top: 30%;
  border-radius: 50%;
  background-color: white;
  overflow: hidden;
}

.left-eye {
  left: 10%;
}

.right-eye {
  right: 10%;
}

.pupil {
  position: absolute;
  bottom: 10%;
  left: 10%;
  width: 80%;
  height: auto;
  padding-top: 80%;
  border-radius: 50%;
  background-color: black;
}

.light {
  position: absolute;
  top: 0;
  right: 0;
  width: 60%;
  height: auto;
  padding-top: 60%;
  border-radius: 50%;
  background-color: white;
}

.eyelid {
  position: absolute;
  left: -20%;
  bottom: 120%;
  width: 140%;
  height: 140%;
  background-color: #E78336;
  transition: background-color 1s linear;
  -webkit-transition: background-color 1s linear;
  -moz-transition: background-color 1s linear;
  -o-transition: background-color 1s linear;
  transition: bottom 0.5s linear;
  -webkit-transition: bottom 0.5s linear;
  -moz-transition: bottom 0.5s linear;
  -o-transition: bottom 0.5s linear;
}


/* CAT'S MOUTH */

.mouth {
  position: absolute;
  top: 50%;
  left: 42.5%;
  width: 15%;
  height: 13%;
  border-radius: 0 0 90% 90%;
  background-color: #F1A9A0;
  overflow: hidden;
  transition: border-radius 0.25s linear;
  -webkit-transition: border-radius 0.25s linear;
  -moz-transition: border-radius 0.25s linear;
  -o-transition: border-radius 0.25s linear;
  transition-delay: 0.25s;
  -webkit-transition-delay: 0.25s;
  -moz-transition-delay: 0.25s;
  -o-transition-delay: 0.25s;
}

.mouth:before,
.mouth:after {
  position: absolute;
  display: block;
  content: "";
  top: 0;
  border-top: 6px solid white;
  border-left: 2px solid transparent;
  border-right: 2px solid transparent;
}

.mouth:before {
  left: 10%;
}

.mouth:after {
  right: 10%;
}


/* SUNNY */

.sun {
  position: absolute;
  width: 15%;
  height: auto;
  padding-top: 15%;
  border-radius: 50%;
  background-color: #F5D76E;
  box-shadow: 0px 0px 0px 5px #F7CA18;
  animation: sunny 2s infinite ease-in-out;
  -webkit-animation: sunny 2s infinite ease-in-out;
  -moz-animation: sunny 2s infinite ease-in-out;
  -o-animation: sunny 2s infinite ease-in-out;
  transition: left 1s linear, top 1s linear;
  -webkit-transition: left 1s linear, top 1s linear;
  -moz-transition: left 1s linear, top 1s linear;
  -o-transition: left 1s linear, top 1s linear;
}

@keyframes sunny {
  0% {
    box-shadow: 0px 0px 0px 5px #F7CA18;
  }
  50% {
    box-shadow: 0px 0px 0px 8px #F7CA18;
  }
  100% {
    box-shadow: 0px 0px 0px 5px #F7CA18;
  }
}


/* CLOUDY */

.cloud {
  position: absolute;
  top: 22%;
  width: 35%;
  height: 12.5%;
  border-radius: 50px;
  background-color: white;
  animation: bouncy-cloud 2s infinite ease-in-out;
  -webkit-animation: bouncy-cloud 2s infinite ease-in-out;
  -moz-animation: bouncy-cloud 2s infinite ease-in-out;
  -o-animation: bouncy-cloud 2s infinite ease-in-out;
  transition: left 1s linear;
  -webkit-transition: left 1s linear;
  -moz-transition: left 1s linear;
  -o-transition: left 1s linear;
}

.cloud:before,
.cloud:after,
.cloud-icon:before,
.cloud-icon:after {
  position: absolute;
  content: "";
  border-radius: 50px;
  background-color: inherit;
}

.cloud:before,
.cloud-icon:before {
  left: 20%;
  top: -60%;
  width: 50%;
  height: 150%;
}

.cloud:after,
.cloud-icon:after {
  right: 15%;
  top: -40%;
  width: 30%;
  height: 90%;
}

@keyframes bouncy-cloud {
  0% {
    width: 35%;
    height: 12.5%;
  }
  50% {
    width: 38%;
    height: 14%;
  }
  100% {
    width: 35%;
    height: 12.5%;
  }
}


/* BUTTON */

.sun-icon {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background-color: #F5D76E;
  box-shadow: 0px 0px 0px 5px #F7CA18;
  display: inline-block;
  position: relative;
  top: -12.5px;
  margin-right: 15px;
}

.cloud-icon {
  width: 35px;
  height: 18px;
  border-radius: 50px;
  background-color: white;
  display: inline-block;
  position: relative;
  top: -10px;
  margin-left: 10px;
}

.centered-text {
  text-align: center;
}

.switch {
  width: 100px;
  height: 40px;
  display: inline-block;
}

.switch input {
  display: none;
}

.slider {
  position: absolute;
  background-color: white;
  width: inherit;
  height: inherit;
  border-radius: 34px;
  cursor: pointer;
}

.slider:before {
  position: absolute;
  left: 5px;
  top: 5px;
  content: "";
  height: 30px;
  width: 30px;
  border-radius: 50px;
  background-color: #469CCE;
  transition: .4s, background-color 1s linear;
  -webkit-transition: .4s, background-color 1s linear;
  -moz-transition: .4s, background-color 1s linear;
  -o-transition: .4s, background-color 1s linear;
}

input:checked + .slider:before {
  background-color: #2c3e50;
}

input:checked + .slider:before {
  -webkit-transform: translateX(60px);
  -ms-transform: translateX(60px);
  transform: translateX(60px);
}
              
            
!

JS

              
                var $sun = $("#sun");
var $cloud = $("#cloud");

function happyCat() {
  $(".eyelid").css("bottom");
  $(".eyelid").css("bottom", "120%");
  $(".mouth").css("border-radius");
  $(".mouth").css("border-radius", "0 0 90% 90%");
  return true;
}

function sadCat() {
  $(".eyelid").css("bottom");
  $(".eyelid").css("bottom", "60%");
  $(".mouth").css("border-radius");
  $(".mouth").css("border-radius", "90% 90% 0 0");
  return true;
}

function addSun() {
  $sun.addClass("sun");
  $sun.css({
    "left": "30%",
    "top": "100%"
  });
  $sun.css("left");
  $sun.css("top");
  $sun.css({
    "left": "57%",
    "top": "13%"
  });
  return true
};

function addCloud() {
  $cloud.addClass("cloud");
  $cloud.css("left", "-35%");
  $cloud.css("left");
  $cloud.css("left", "34%");
  $("body").css("background-color", "#2c3e50");
  $(".cat, .eyelid").css({
    "background-color": " #D06C1F",
    "border-bottom-color": "#D06C1F"
  });
  sadCat();
  return true;
}

function removeCloud() {
  $cloud.css("left");
  $cloud.css("left", "-35%");
  $("body").css("background-color", "#469CCE");
  $(".cat, .eyelid").css({
    "background-color": "#E78336",
    "border-bottom-color": "#E78336"
  });
  happyCat();
  return true;
}

$(document).ready(function() {
  addSun();

  $(".cat").mouseenter(function() {
    sadCat();
  });

  $(".cat").mouseleave(function() {
    happyCat();
  });

  $('input[type="checkbox"]').click(function() {
    if ($(this).is(":checked")) {
      addCloud();
    } else if ($(this).is(":not(:checked)")) {
      removeCloud();
    }
  });

});
              
            
!
999px

Console