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

              
                <form>
	<input class="ch" type="checkbox" name="temperature" value="is_hot">
</form>
              
            
!

CSS

              
                *, *:before, *:after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}
:root {
	font-size: calc(16px + (24 - 16) * (100vw - 320px)/(1600 - 320));
}
body {
	background: rgb(235,167,49);
	line-height: 1.5;
}
input {
	display: inline-block;
}
form {
	padding: 3em 1.5em 0 1.5em;
	text-align: center;	
}
.ch, .ch:before, .ch:after {
	transition: all 0.3s ease-in-out;
}
.ch {
	background-color: rgb(27,123,145);
	border-radius: 0.2em;
	box-shadow: 0 0.05em 0 0.05em rgba(0,0,0,0.3) inset;
	font-size: 4em;
	overflow: hidden;
	position: relative;
	width: 3em;
	height: 1.5em;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	z-index: 0;
}
.ch:before, .ch:after {
	content: "";
	display: block;
	position: absolute;
}
.ch:before {
	background-color: currentColor;
	border-radius: 0.125em;
	box-shadow:
		0 0 0 0.05em inset,
		-0.12em -0.12em 0 rgb(109,148,184) inset,
		-0.4em -0.3em 0 0.05em inset,
		0.12em 0.12em 0 rgb(255,255,255) inset;
	color: rgb(149,188,224);
	opacity: 0.9;
	bottom: 0;
	left: 0.125em;
	width: 1.25em;
	height: 1.25em;
	z-index: 2;
}
.ch:after {
	background-image:
		/* white */
		radial-gradient(0.2em 0.5em at 38% 95%, rgb(255,255,255) 49%, rgba(255,255,255,0) 50%),
		radial-gradient(0.3em 0.8em at 52% 95%, rgb(255,255,255) 49%, rgba(255,255,255,0) 50%),
		radial-gradient(0.25em 0.4em at 67% 95%, rgb(255,255,255) 49%, rgba(255,255,255,0) 50%),
		/* yellow */
		radial-gradient(0.25em 0.7em at 36% 95%, rgb(255,224,0) 49%, rgba(255,224,0,0) 50%),
		radial-gradient(0.4em 1.2em at 52% 95%, rgb(255,224,0) 49%, rgba(255,224,0,0) 50%),
		radial-gradient(0.25em 0.6em at 70% 93%, rgb(255,224,0) 49%, rgba(255,224,0,0) 50%),
		/* orange */
		radial-gradient(0.3em 0.8em at 32% 81%, rgb(255,144,0) 49%, rgba(255,144,0,0) 50%),
		radial-gradient(0.5em 1.6em at 52% 95%, rgb(255,144,0) 49%, rgba(255,144,0,0) 50%),
		radial-gradient(0.3em 0.9em at 74% 86%, rgb(255,144,0) 49%, rgba(255,144,0,0) 50%),
		/* red-orange */
		radial-gradient(0.4em 1em at 25% 70%, rgb(255,76,0) 49%, rgba(255,76,0,0) 50%),
		radial-gradient(0.7em 2.75em at 52% 100%, rgb(255,76,0) 49%, rgba(255,76,0,0) 50%),
		radial-gradient(0.4em 1.2em at 79% 75%, rgb(255,76,0) 49%, rgba(255,76,0,0) 50%);

	background-position: 100% 1.5em;
	background-size: 1.5em 1.5em;
	background-repeat: no-repeat;
	border-radius: 0 0 0 0.1em / 0 0 0 0;
	box-shadow: 0 0 0 0 rgb(169,208,244) inset;
	bottom: 0;
	left: 0;
	width: 1.5em;
	height: 1.5em;
	z-index: 1;
}
/* Checked */
.ch:checked {
	background-color: rgb(92,8,8);
}
.ch:checked:before {
	border-radius: 50%;
	transform: translate(1.5em,1.5em) rotate(45deg) scale(0.5);
}
.ch:checked:after {
	background-position: 100% 0;
	box-shadow: 0 -0.15em 0 0 rgb(169,208,244) inset;
	width: 3em;
}

/* Other States */
.ch:focus {
	/* Usually an anti-A11Y practice but set to remove an annoyance just for this demo */
	outline: 0;
}
              
            
!

JS

              
                
              
            
!
999px

Console