Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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>
	<label for="brightness">Brightness</label>
	<input type="range" id="brightness" name="brightness" min="1" max="100" value="100">
</form>
              
            
!

CSS

              
                // mixins
@mixin thumb()
	$bg1: linear-gradient(var(--p),var(--p)) 70% 50% / 20% 5% no-repeat
	$bg2: linear-gradient(var(--l2),var(--l2)) 70% 50% / 20% 15% no-repeat
	$bg3: radial-gradient(100% 100% at 50% 50%,var(--pT) 14%,var(--p) 15% 19%,var(--pT) 20%)
	border: 0
	background: $bg1, $bg2, $bg3, var(--l2)
	border-radius: 50%
	box-shadow: -0.25em 0 0.5em var(--l3), 0.25em 0 0.5em var(--l1)
	width: 1.5em
	height: 1.5em
	-webkit-appearance: none
	-moz-appearance: none
	appearance: none

// normal styles
*
	border: 0
	box-sizing: border-box
	margin: 0
	padding: 0
\:root
	font-size: calc(48px + 24 * (100vw - 320px) / (1280 - 320))
body, form
	display: flex
body, input
	font: 1em/1.5 sans-serif
body
	--l1: hsl(228,9.8%,100%)
	--l2: hsl(228,9.8%,90%)
	--l3: hsl(228,9.8%,63%)
	--p: hsl(120,90.4%,44.9%)
	--pT: hsla(120,90.4%,44.9%,0)
	background-color: var(--l2)
	height: 100vh
form, input[type=range]
	margin: auto
form
	height: 6em
input[type=range], label
	-webkit-tap-highlight-color: transparent
input[type=range]
	background-color: transparent
	border-radius: 0.75em
	box-shadow: -0.1em -0.1em 0.1em var(--l3) inset, 0.1em 0.1em 0.1em var(--l1) inset
	cursor: pointer
	transform: rotate(-90deg)
	height: 1.5em
	width: 6em
	-webkit-appearance: none
	-moz-appearance: none
	appearance: none
	&:focus
		outline: transparent
	&::-webkit-slider-thumb
		@include thumb()
	&::-moz-range-thumb
		@include thumb()
	&::-moz-focus-outer
		border: 0
label
	clip: rect(1px,1px,1px,1px)
	overflow: hidden
	position: absolute
	width: 1px
	height: 1px
              
            
!

JS

              
                document.addEventListener("DOMContentLoaded",function(){
	let slider = this.getElementById("brightness");
	slider.addEventListener("input",adjustSlider);
	adjustSlider(slider);
});
function adjustSlider(e) {
	let body = document.body,
		switchLightMin = 40,
		switchLightMax = 100,
		tar = e.target || e,
		pct = +tar.value / +tar.max,
		L1 = pct * (switchLightMax - switchLightMin) + switchLightMin,
		L2 = L1 - 10,
		L3 = L1  - 37,
		L = [L1,L2,L3],
		thumbHueMin = 0,
		thumbHueMax = 120,
		thumbHue = pct * (thumbHueMax - thumbHueMin) + thumbHueMin,
		thumbSat = 90.4,
		thumbLight = 44.9,
		thumbHSL = `${thumbHue},${thumbSat}%,${thumbLight}%`;

	// update the slider shade
	L.forEach((light,i) => {
		if (light < 0)
			light = 0;
		body.style.setProperty(`--l${i + 1}`,`hsl(228,9.8%,${light}%)`);
	});
	// update the thumb icon hue
	body.style.setProperty(`--p`,`hsl(${thumbHSL})`);
	body.style.setProperty(`--pT`,`hsla(${thumbHSL},0)`);
}
              
            
!
999px

Console