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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              - var val = 75;

form(style=`--val: ${val}`)
	input#r(type='range' value=val)
	output(for='r') #{val}
              $base-sh: inset 0 -1px 1px #9daabb, 
		inset 0 1px .125em #0f1110;
$base-bg: linear-gradient(to right top, #474747, #202020);

$track-pad: .7em;
$track-w: 32em;
$track-h: 1.75em;
$track-bg: linear-gradient(#4c4c4c 50%, 
  #111 0, transparent) content-box, $base-bg;

$fill-h: .5*($track-h - 2*$track-pad);
$fill-bg: linear-gradient(90deg, #ffe14c, #ff4c8a);

$thumb-d: $track-h;
$thumb-sh: ();

@for $i from 1 to 10 {
	$thumb-sh: $thumb-sh, 0 $i*1px $i*1px rgba(#000, .2);

@mixin track($fill: false) {
	box-sizing: border-box;
	padding: $track-pad;
	width: $track-w; height: $track-h;
	border-radius: .5*$track-h;
	box-shadow: $base-sh;
	background: $track-bg;
	/* if the fill/ progress is included in track
	 * because there's no standalone pseudo */
	@if $fill == true {
		.js & {
			background: $fill-bg 
				0 50%/ calc(var(--val)*1%) $fill-h 
					no-repeat content-box, $track-bg;

@mixin fill() {
	height: $fill-h;
	background: $fill-bg;

@mixin thumb() {
	box-sizing: border-box;
	border: solid 1px rgba(#eee, .1);
	width: $thumb-d; height: $thumb-d;
	border-radius: 50%;
	transform: translateY(-1px);
	box-shadow: $thumb-sh;
	background: conic-gradient(#8a8a8a, #e0e0e0, #909090, #f1f2f1, #949392, #cfcfcf, #8a8a8a);
	background-color: #949392; /* fallback */

* { font: inherit }

body {
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	height: 100vh;
	background: /* double gradient because IE */
		radial-gradient(rgba(#49586b, .85), rgba(#091521, .75)), 
		radial-gradient(rgba(#49586b, .25), rgba(#091521, .25));
	background-blend-mode: multiply

form {
	display: flex;
	align-items: center;
	font: 600 .675em/#{$track-h} arial, sans-serif; /* level things */

[type='range'] {
	&::-webkit-slider-thumb, & {
		-webkit-appearance: none
	box-sizing: border-box;
	margin-right: 1em;
	width: $track-w; height: 3*$track-h;
	background: none; /* fix Chrome white */
  cursor: pointer;
	/* track styles */
	&::-webkit-slider-runnable-track {
		@include track(true)
	&::-moz-range-track { @include track() }
	&::-ms-track {
		@include track();
		border: none; /* remove black border */
		color: transparent /* remove ticks */
	/* fill/ progress styles */
	&::-moz-range-progress {
		padding-left: $track-pad;
		@include fill();
		background-clip: content-box
	&::-ms-fill-lower { @include fill() }
	/* thumb styles */
	&::-webkit-slider-thumb {
		/* to fix Chrome weird shit */
		margin-top: .5*($fill-h - $thumb-d);
		@include thumb()
	&::-moz-range-thumb {
		@include thumb();
		/* Firefox-only, it won't work in IE 
       and it's messed up in Chrome */
    cursor: ew-resize
	&::-ms-thumb {
		/* -webkit-thumb styles get applied needlessly
		 * and they break stuff that was working fine, 
		 * so we need to fix that mess */
		margin-top: 0;
		@include thumb()
	/* what we want hidden */	
	&::-ms-tooltip { display: none }
	html:not(.js) & + output { display: none }
	&:focus {
		outline: none;
		&, + output {
			filter: drop-shadow(0 0 .5em rgba(cyan, .7))
	& + output {
		width: 5em; height: $track-h;
		border-radius: .5*$track-h;
		box-shadow: $base-sh;
		background: $base-bg;
		color: #c4c4c4;
		text-align: center;
		&:after { content: '%' }
              const _R = document.getElementById('r'), 
			_F = document.querySelector('form'), 
			_O = document.querySelector('output[for=r]');

let val = +_R.value;

function update() {
	let newval = +_R.value;
	if(newval !== val) {
		val = newval;
		_F.style.setProperty('--val', val);
		_O.textContent = val;


_R.addEventListener('input', update, false);
_R.addEventListener('change', update, false);
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.