cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

              <div class="center">
  <h1>Programming Simulator</h1>

  <div class="switch">
    <input id="one" class="input" type="checkbox" />
    <label for="one" class="slider"></label>
    <label for="one" class="label">Bug #1</label>
  <div class="switch">
    <input id="two" class="input" type="checkbox" />
    <label for="two" class="slider"></label>
    <label for="two" class="label">Bug #2</label>
  <div class="switch">
    <input id="three" class="input" type="checkbox" />
    <label for="three" class="slider"></label>
    <label for="three" class="label">Bug #3</label>
  <div class="switch">
    <input id="four" class="input" type="checkbox" />
    <label for="four" class="slider"></label>
    <label for="four" class="label">Bug #4</label>
  <div class="switch">
    <input id="five" class="input" type="checkbox" />
    <label for="five" class="slider"></label>
    <label for="five" class="label">Bug #5</label>
  <div class="switch">
    <input id="six" class="input" type="checkbox" />
    <label for="six" class="slider"></label>
    <label for="six" class="label">Bug #6</label>
  <div class="switch">
    <input id="seven" class="input" type="checkbox" />
    <label for="seven" class="slider"></label>
    <label for="seven" class="label">Bug #7</label>
  <div class="switch">
    <input id="eight" class="input" type="checkbox" />
    <label for="eight" class="slider"></label>
    <label for="eight" class="label">Bug #8</label>
 * Switch Styles by Alexandre Joffroy
 * - https://codepen.io/alexjoffroy/pen/ORXOmR

$switch-on-color: #ef0460 !default;
$slider-on-color: lighten($switch-on-color, 20%) !default;

$switch-off-color: #eeeeee;
$slider-off-color: #c5c5c5;

// Sizes
$slider-height: 8px !default;
$slider-width: $slider-height * 4 !default; // 32px
$switch-height: $slider-height * 3 !default; // 24px
$switch-width: $switch-height !default; // 24px
$switch-shift: $slider-height !default; // 8px

// Transitions
$transition-duration: .2s !default;
$transition-function: ease !default;
$transition: all $transition-duration $transition-function !default;

.switch {
  display: block;
  margin-top: $switch-height;
  .slider {
    position: relative;
    display: inline-block;
    height: $slider-height;
    width: $slider-width;
    border-radius: $slider-height;
    cursor: pointer;
    background: $slider-off-color;
    transition: $transition;
    &:after {
      background: $switch-off-color;
      position: absolute;
      left: -$switch-shift;
      top: ($slider-height - $switch-height) / 2;
      display: block;
      width: $switch-height;
      height: $switch-width;
      border-radius: 50%;
      box-shadow: 0px 2px 2px rgba(#000, .2);
      content: '';
      transition: $transition;
  label {
    margin-right: 7px;
  .input {
    display: none;
    ~ .label {
      margin-left: $slider-height;
    &:checked ~ .slider {
      &:after {
        left: $slider-width - $switch-width + $switch-shift;
  .input:checked ~ .slider {
    background: $slider-on-color;

    &:after {
      background: $switch-on-color;

@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro');

.center {
  font-family: 'Source Sans Pro', sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  user-select: none;    

h1 {
  font-weight: normal;
  margin-top: 0px;
              var checkboxes = document.querySelectorAll('input');

for( var i = 0; i < checkboxes.length; i++ ) {

  checkboxes[i].addEventListener("change", function() {

function updateBugs(changedElement) {
  var checkedCount = document.querySelectorAll('input:checked').length;

  // No bugs, thats impossible!
  if( checkedCount === 0 ) {
    if( Math.random() > 0.85 ) {

function turnOnRandomBug(excluding) {
  turnOn = Math.floor(Math.random() * checkboxes.length);

  if( checkboxes[turnOn] === excluding) {
    turnOn = turnOn + 1;
    if( turnOn > (checkboxes.length - 1)) {
      turnOn = 0;

  checkboxes[turnOn].checked = true;

setTimeout(function() {
}, 400)


Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.


Loading ..................