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.

            
              <div class="q-container">
  <div class="main">
    <input type="checkbox" id="hidcheck" hidden>
    <label class="capsule" for="hidcheck" id="capsule-id">
      <div class="circle"></div>
      <div class="text-signs">
        <span id="on"></span>
      </div>
    </label>
  </div>
</div>
            
          
!
            
              html, body {
	margin: 0;
	padding: 0;
}

.q-container {
	display: inline-block;
	padding: 30px;
	margin: auto;
	background-color: rgb(240,240,240);
}

label.capsule {
	display: block;
	width: 60px;
	border: 1px solid rgb(200,200,200);
	line-height: 30px;
	border-radius: 25px;
	background-color: #EF9A9A;
}

.circle {
	margin-top: 5px;
	margin-left: 5px;
	position: absolute;
	height: 20px;
	width: 20px;
	border-radius: 30px;
	/*border: 1px solid black;*/
	background-color: rgb(219, 218, 218);
	box-shadow: 2px 1px 1px 0px rgb(109, 105, 105);
}

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

.text-signs span {
	user-select:none;
	-webkit-user-select:none;
	color: rgb(93, 81, 81);
}

#hidcheck:checked ~ .capsule .text-signs #on {
	margin-left: -12px;
	animation-name:toggle-on;
	animation-duration:400ms;
	animation-fill-mode:forwards;
	animation-timing-function:ease-out;
}

#hidcheck:checked ~ .capsule .text-signs #on:before {
	content: "on"
}

#hidcheck:not(:checked) ~ .capsule .text-signs #on {
	margin-left: 12px;
	animation-name:toggle-off;
	animation-duration:400ms;
	animation-fill-mode:forwards;
	animation-timing-function:ease-out;
}

#hidcheck:not(:checked) ~ .capsule .text-signs #on:after {
	content: "off"
}

@-webkit-keyframes toggle-on {
	0% {margin-left: 0px;}
	100% {margin-left: -12px;}
}

@-webkit-keyframes toggle-off {
	0% {margin-left: 0px;}
	100% {margin-left: 12px;}
}

#hidcheck:checked ~ .capsule {
	background-color: #8BC34A;
}

#hidcheck:checked ~ .capsule .circle {
	animation-name:toggle;
	animation-duration:400ms;
	animation-fill-mode:forwards;
	animation-timing-function:ease-out;
}

#hidcheck:not(:checked) ~ .capsule .circle {
	animation-name:toggle-back;
	animation-duration:400ms;
	animation-fill-mode:forwards;
	animation-timing-function:ease-in-out;
	animation-direction:reverse;
}

@-webkit-keyframes toggle-back {
	0% {
		margin-left: 2px;
		box-shadow: 2px 1px 1px 0px rgb(109, 105, 105);
    }

    10% {
    	width: 22px;
    }

    20% {
    	width: 23px;
    }

    30% {
    	width: 24px;
    }

    40% {
    	width: 25px;
    }

    45% {
    	width: 27px;
    }

    50% {
    	width: 29px;
    }

    55% {
    	width: 27px;
    }

    60% {
    	width: 23px;
    }

    70% {
    	width: 22px;
    }

    80% {
    	width: 21px;
    }

    90% {
    	width: 20px;
    }

    100% {
    	margin-left: 38px;
		width: 20px;
    	height: 20px;
    	box-shadow: -2px 1px 1px 0px rgb(109, 105, 105);
    }
}

@-webkit-keyframes toggle {
    0% {
		margin-left: 2px;
		box-shadow: 2px 1px 1px 0px rgb(109, 105, 105);
    }

    10% {
    	width: 22px;
    }

    20% {
    	width: 23px;
    }

    30% {
    	width: 24px;
    }

    40% {
    	width: 25px;
    }

    45% {
    	width: 27px;
    }

    50% {
    	width: 29px;
    }

    55% {
    	width: 27px;
    }

    60% {
    	width: 23px;
    }

    70% {
    	width: 22px;
    }

    80% {
    	width: 21px;
    }

    90% {
    	width: 20px;
    }

    100% {
    	margin-left: 38px;
		width: 20px;
    	height: 20px;
    	box-shadow: -2px 1px 1px 0px rgb(109, 105, 105);
    }
}
            
          
!
999px
Loading ..................

Console