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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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="toggle-wrapper">
  <input type="checkbox" class="doggle" id="doggle"/>
  <label for="doggle" class="toggle">
    <span class="toggle-handler">
      <span class="face eye-left"></span>
      <span class="face eye-right"></span>
      <span class="nose"></span>
      <span class="face mouth1"></span>
      <span class="face mouth2"></span>
      <span class="face2 mouth-smile"></span>
      <span class="face2 mouth-smile2"></span>
      <span class="left-ear">
      <span class="right-ear">
      <span class="tongue"></span>
     </span>
  </label>
</div>
              
            
!

CSS

              
                body {
  background-color: #002147;
  font-family: 'Arial Rounded MT Bold', sans-serif;
  
  //CSS Variables
  --text-before: #fff;
  --text-after: #749ED7;
  --face-before: #AEB8D1;
  --face-after: #679DFF;
  --face-details-before: #5B6F8F;
  --face-details-after: rgba(0,33,71,1);
  --tongue: red;
}

.toggle-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  height: 90px;
  padding: 0 200px;
  transform: translate3d(-50%, -50%, 0);
  
  input {
    position: absolute;
    left: -99em;
  }
}

.toggle {
  cursor: pointer;
  display: inline-block;
  position: relative;
  width: 90px;
  height: 50px;
  background-color: white;
  border-radius: 90px - 6;
  font-size: 18px;
  
  &:before {
    content: 'Not Going to Dog Jog';
    position: absolute;
    right: -65px;
    top: 60px;
    width: 195px;
    color: var(--text-before);
  }
  
  &:after {
    content: 'Going to Dog Jog!';
    position: absolute;
    top: 60px;
    right: -35px;
    width: 160px;
    color: var(--text-after);
  }
}

.toggle-handler {
  display: inline-block;
  position: relative;
  z-index: 1;
  top: 4px;
  left: 4px;
  width: 50px - 8;
  height: 50px - 8;
  background-color: var(--face-before);
  border-radius: 50px;
  transition: all 400ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
  transform:  rotate(-45deg);
}

.face { 
  position: absolute;
  background-color: var(--face-details-before);
  opacity: 1;
  transition-delay: 200ms;
  transform: rotate(45deg);  
}

.eye-left {
  top: 8px;
  left: 16px;
  z-index: 0;
  border-radius: 50%;
  width: 7px;
  height: 7px;
}

.eye-right {
  top: 19px;
  left: 27px;
  z-index: 0;
  border-radius: 50%;
  width: 7px;
  height: 7px;
}

.nose {
  transition-delay: 200ms;
  position: absolute;
	width: 0;
	height: 0;
  left: 12px;
  top: 20px;
  border-radius: 50%;
  transform: rotate(45deg);
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-top: 8px solid var(--face-details-before);
}

.mouth1 {
  top: 24px;
  left: 14px;
  z-index: 0;
  width: 2px;
  height: 6px;
}

.mouth2 {
  top: 28px;
  left: 6px;
  border-radius: 25%;
  z-index: 0;
  width: 14px;
  height: 2px;
}

.face2 {
  transition-delay: 200ms;
  opacity: 0;
}

.mouth-smile {
  position: absolute;
  left: 12px;
  top: 21px;
  -webkit-transform: translate(-50%, 0%);
  transform: translate(-50%, 0%) rotate(45deg);
  width: 11px;
  height: 6px;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  border: 2px solid var(--face-details-after);
  border-top: 0;
  box-sizing: border-box;
}
.mouth-smile2 {
  position: absolute;
  left: 18px;
  top: 27px;
  -webkit-transform: translate(-50%, 0%);
  transform: translate(-50%, 0%) rotate(45deg);
  width: 11px;
  height: 6px;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  border: 2px solid var(--face-details-after);
  border-top: 0;
  box-sizing: border-box;
}

.left-ear {
  transition-delay: 200ms;
  position: absolute;
  top: -10px;
  left: 10px;
  width: 5px;
  height: 10px;
  border-top: 7px solid var(--face-before);
  border-right: 8px solid var(--face-before);
  border-radius: 15% 20%;
}

.right-ear {
  transition-delay: 200ms;
  position: absolute;
  top: 19px;
  left: 27px;
  width: 5px;
  height: 10px;
  border-top: 7px solid var(--face-before);;
  border-left: 8px solid var(--face-before);;
  border-radius: 20% 15%;
  transform: rotate(80deg);  
}

.tongue {
  opacity: 0;
  transition-delay: 200ms;
  width: 7px;
  height: 7px;
  background-color: var(--tongue);
  position: absolute;
  bottom: -28px;
  left: -4px;
  transform: rotate(145deg);
  border-radius: 50% 50% 50% 50% / 80% 80% 20% 20%;
}

input:not(:checked) {
  + .toggle {
  
    &:before {
      display: block; 
    }
    &:after {
      display: none; 
    }
  }
}

input:checked {
  + .toggle {
 
    &:before {
      display: none;
    }

    &:after {
      display: block;
    }
    
    .toggle-handler {
      background-color: var(--face-after);
      transform: translate3d(40px, 0, 0) rotate(-45deg);
  
      .face {
        background-color: var(--face-details-after);
      }

      .nose {
	      border-top: 8px solid var(--face-details-after);
      }

      .right-ear {
        border-top: 7px solid var(--face-after);
        border-left: 8px solid var(--face-after);
      }

      .left-ear {
        border-top: 7px solid var(--face-after);
        border-right: 8px solid var(--face-after);        
      }

      .mouth2 {
        opacity: 0;
      }
      
      .face2,
      .tongue{
        opacity: 1;
      }
    }
  } 
}

              
            
!

JS

              
                // A dog toggle inspired by Outdoor Voices upcoming Dog Jog 🐶
              
            
!
999px

Console