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.

+ add another resource


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


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.


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.


	<section class='slider'>
		<input id='a0' type='range'/>
		<label for='a0'>--a0: <output for='a0'>.5</output></label>
	<section class='slider'>
		<input id='a1' type='range'/>
		<label for='a1'>--a1: <output for='a1'>.5</output></label>

		<img src='' alt='Amur leopard staring the camera with an intrigued look, as if it was preparing to strike'>

	<section class='toggle'>
		<input type='radio' id='n0' name='n' value='0'/>
		<label for='n0' style='--i: 0'>one layer</label>
		<input type='radio' id='n1' name='n' value='1'/>
		<label for='n1' style='--i: 1' checked>two layers</label>


                $thumb-d: 1.5em;
$thumb-r: .5*$thumb-d;
$track-h: .25em;
$track-r: .5*$track-h;
$track-w: 15em;
$input-h: 1.5*$thumb-d;
$dots: .1*$track-w;
$bg: #222;
$fg: #eee;
$ll: #bbb;
$hl: #f90;
$t: .3s;

@mixin track() {
	border: none;
	width: 100%; height: $track-h;
	border-radius: $track-r;
	background: $ll;
		radial-gradient(circle at calc(var(--pos) + #{$thumb-r}) 50%, 
			transparent $thumb-r, $ll calc(#{$thumb-r} + 1px));
	color: transparent;

@mixin thumb() {
	box-sizing: border-box;
	border: none;
	width: $thumb-d; height: $thumb-d;
	transform: scale(calc((.5 + .5*var(--hl))));
	border-radius: 50%;
	background: $hl;
	transition: $t

* { --hl: 0; margin: 0; font: inherit }

body {
	--a0: .5;
	--a1: .5;
	--n: 1;
	display: grid;
	grid-template-rows: max-content 1fr max-content;
	overflow-x: hidden;
	margin: 0;
	min-width: 275px;
	min-height: 100vh;
	color: $hl;
	font: 900 1em segoe script, comic sans ms, purisa, cursive;
	@media (max-width: 400px) { font-size: .875em }

form {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	width: 100%;
	background: $bg;
	color: $fg;
	font: 1.25em consolas, monospace, ubuntu mono;
	text-align: center

section { padding: .5em }

.slider {
	&:nth-child(1) { --a: var(--a0) }
	&:nth-child(2) { --a: var(--a1) }

[id], [for], .toggle {
	filter: Contrast(var(--hl)) Brightness(calc(2 - var(--hl))) GrayScale(calc(1 - var(--hl)))

input {
	&:focus { 
		outline: solid 0 transparent;
		&, & ~ [for] { --hl: 1 }

input[type='range'] {
	&::-webkit-slider-thumb, & { -webkit-appearance: none }
	--pos: calc(var(--a)*#{$track-w});
	display: block;
	border: solid 0 transparent;
	padding: .25em 0;
	width: calc(#{$track-w} + #{$thumb-d});
	height: $input-h;
	background: transparent;
	cursor: pointer;
	&::-webkit-slider-runnable-track { @include track }
	&::-moz-range-track { @include track }
	&::-ms-track { @include track }
	&::-webkit-slider-thumb {
		margin-top: .5*($track-h - $thumb-d);
		@include thumb;
	&::-moz-range-thumb { @include thumb }
	&::-ms-thumb {
		margin-top: 0;
		@include thumb
	&::-ms-fill-upper {
		background: transparent;

	&::-ms-tooltip { display: none }

main { 
	flex: 1;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center

figure {
	position: relative;
	margin: .5vmin;
	width: $track-w + $thumb-d;
	&:before, &:after {
		position: absolute;
		top: 0; left: 0;
		padding: 50%;
		background: $hl;
		content: ''
		&:before { opacity: calc(var(--a0) + (1 - var(--n))*(var(--a1) - var(--a0)*var(--a1))) }
		&:after { opacity: calc(var(--n)*var(--a1)) }

img { width: 100% }

figcaption { font-size: 1.5em }

.toggle {
	display: grid;
	place-content: center;
	grid-auto-flow: row dense;
	grid-template-columns: max-content 2*$thumb-d max-content;
	transition: filter $t ease-out;
	&::before, &::after {
		grid-column: 2;
		grid-row: 1;
		z-index: 0;
		height: $thumb-d;
		border-radius: $thumb-r;
		content: ''
	&::before { box-shadow: 0 0 0 2px }
	&::after {
		box-sizing: border-box;
		padding: 2px;
		width: $thumb-d;
		transform: translate(calc((1 - var(--n))*100%));
		background: $hl content-box;
		transition: transform $t ease-out;
	&:focus-within { --hl: 1 }

input[type='radio'] {
	position: absolute;
	right: 100vw;
	clip-path: inset(50%);
	+ label {
		--j: calc(1 - var(--i));
		align-self: center;
		grid-column: calc(2*var(--j) + 1);
		position: relative;
		z-index: 1;
		padding: 0 .5em;
		cursor: pointer;
		&::before {
			position: absolute;
			top: calc(50% - #{$thumb-r});
			left: calc(var(--i)*100% - var(--j)*#{$thumb-d});
			width: $thumb-d; height: $thumb-d;
			content: ''
	&:checked + label { color: $hl }


                function update(e) {
	let _t =, id =, val;
	if(_t.type === 'range') {
		val = +(.01*_t.value).toFixed(2);
		document.querySelector(`output[for='${id}']`).textContent = val;`--${id}`, val)
	if(_t.type === 'radio') {
		val = +_t.value;`--${}`, val)

addEventListener('input', update, false);
addEventListener('change', update, false);