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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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>
	<label for="longcat1">Longcat 1</label>
	<input type="range" id="longcat1" name="longcat1" min="0" max="5" value="3">
	<br>
	<label for="tacgnol1">Tacgnol 1</label>
	<input type="range" id="tacgnol1" name="tacgnol1" min="0" max="10" value="5">
	<br>
	<label for="longcat2">Longcat 2</label>
	<input type="range" id="longcat2" name="longcat2" min="0" max="20" value="10">
	<br>
	<label for="tacgnol2">Tacgnol 2</label>
	<input type="range" id="tacgnol2" name="tacgnol2" min="0" max="100" value="50">
</form>
              
            
!

CSS

              
                // colors
$w1: hsl(0,0%,100%);
$w1T: hsla(0,0%,100%,0);
$w2: hsl(0,0%,85%);
$w2T: hsla(0,0%,85%,0);
$bl: hsl(210,50%,75%);
$blT: hsla(210,50%,75%,0);
$gn: hsl(90,50%,75%);
$gnT: hsla(90,50%,75%,0);
$bk1: hsl(0,0%,10%);
$bk1T: hsla(0,0%,10%,0);
$bk2: hsl(0,0%,25%);
$bk2T: hsla(0,0%,25%,0);
$pk: hsl(0,60%,75%);
$pkT: hsla(0,60%,75%,0);

// mixins
@mixin thumbBaseProps() {
	background-repeat: no-repeat;
	border: 0;
	width: 2em;
	height: 2.5em;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}
@mixin catHead($headColor,$shadowColor,$eyeColor) {
	$headColorT: fade-out($headColor,1);
	$shadowColorT: fade-out($shadowColor,1);
	$eyeColorT: fade-out($eyeColor,1);
	background:
		// right eye
		radial-gradient(0.2em 0.4em at 0.75em 0.875em,$bk1 45%,$bk1T 50%),
		radial-gradient(0.5em 0.5em at 0.75em 0.875em,$eyeColor 47%,$eyeColorT 50%),
		// left eye
		radial-gradient(0.2em 0.4em at 1.5em 0.875em,$bk1 45%,$bk1T 50%),
		radial-gradient(0.5em 0.5em at 1.5em 0.875em,$eyeColor 47%,$eyeColorT 50%),
		// mouth
		radial-gradient(0.45em 0.4em at 0.875em 1.325em,$headColor 47%,$headColorT 50%),
		radial-gradient(0.45em 0.4em at 1.375em 1.325em,$headColor 47%,$headColorT 50%),
		radial-gradient(0.5em 0.4em at 0.925em 1.375em,$shadowColor 47%,$shadowColorT 50%),
		radial-gradient(0.5em 0.4em at 1.325em 1.375em,$shadowColor 47%,$shadowColorT 50%),
		// nose
		radial-gradient(0.375em 0.375em at 1.125em 1.25em,$pk 47%,$pkT 50%),
		// head
		radial-gradient(2em 1.5em at 50% 1em,$headColor 47%,$headColorT 50%),
		radial-gradient(2em 1.5em at 50% 1.1em,$shadowColor 47%,$shadowColorT 50%),
		// ears
		radial-gradient(0.5em 1.5em at 0.375em 0.75em,$pk 39%,$headColor 40% 48%,$headColorT 50%),
		radial-gradient(0.5em 1.5em at 1.5em 0.75em,$pk 39%,$headColor 40% 48%,$headColorT 50%),
		// paws
		radial-gradient(0.5em 1.75em at 0.25em 1.5em,$headColor 47%,$headColorT 50%),
		radial-gradient(0.5em 1.75em at 0.25em 1.6em,$shadowColor 47%,$shadowColorT 50%),
		radial-gradient(0.5em 1.75em at 0.65em 1.6em,$shadowColor 47%,$shadowColorT 50%);
	@include thumbBaseProps();
}
@mixin catTorso($torsoColor,$shadowColor) {
	$torsoColorT: fade-out($torsoColor,1);
	$shadowColorT: fade-out($shadowColor,1);
	box-shadow: 0 -0.25em 0 $shadowColor inset;
	&, &:before {
		background-color: $torsoColor;
	}
	&:before {
		box-shadow: 0 -0.1em 0 $shadowColor inset;
	}
	&:after {
		background:
			// legs
			radial-gradient(0.5em 1.75em at 0.25em -0.1em,$torsoColor 47%,$torsoColorT 50%),
			radial-gradient(0.5em 1.75em at 0.25em 0,$shadowColor 47%,$shadowColorT 50%),
			radial-gradient(0.5em 1.75em at 0.65em 0,$shadowColor 47%,$shadowColorT 50%);
		background-repeat: no-repeat;
	}
}

// normal styles
* {
	border: 0;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}
:root {
	font-size: calc(20px + (30 - 20) * (100vw - 320px) / (1280 - 320));
}
body, input {
	font: 1em/1.5 Oswald, Impact, sans-serif;
}
body {
	background: hsl(58,44.7%,50.4%);
	color: $bk1;
	display: flex;
	height: 100vh;
}
form {
	margin: auto;
	padding: 1.5em 0;
}
.longcat {
	margin-bottom: 0.5em;
	position: relative;
	width: 9em;
	height: 4em;
	&__torso, &__torso:before, &__torso:after, &__input, &__value, &__sr {
		position: absolute;
	}
	&__torso, &__torso:before, &__torso:after {
		content: "";
		display: block;
	}
	&__torso {
		border-radius: 0.5em 0 0.25em 0;
		top: 0.875em;
		height: 1em;
		&, &:after {
			left: 0;
		}
		&:before {
			border-radius: 0.5em;
			top: 0;
			left: -1em;
			width: 1.5em;
			height: 0.25em;
			transform: rotate(-40deg) {
				origin: 1.375em 0.125em;
			}
			transition: transform 0.25s ease-in-out;
			z-index: -1;
		}
		&:after {
			top: 0.75em;
			width: 1em;
			height: 0.875em;
		}
	}
	&__input {
		background-color: transparent;
		box-shadow: 1px 0 0 $bk2;
		cursor: pointer;
		height: 2.5em;
		width: 100%;
		z-index: 1;
		-webkit-appearance: none;
		-moz-appearance: none;
		appearance: none;
		-webkit-tap-highlight-color: transparent;
		&:focus {
			outline: transparent;
		}
		&::-moz-focus-outer {
			border: 0;
		}
	}
	&__input:active + &__torso:before, &__input:focus + &__torso:before {
		transform: rotate(15deg);
	}
	&__value {
		top: 2.5em;
		left: 0;
		text-align: center;
		width: 100%;
	}
	&__sr {
		clip: rect(1px,1px,1px,1px);
		overflow: hidden;
		width: 1px;
		height: 1px;
	}
	&--light &__torso {
		@include catTorso($w1,$w2);
	}
	&--light &__input {
		&::-webkit-slider-thumb {
			@include catHead($w1,$w2,$bl);
		}
		&::-moz-range-thumb {
			@include catHead($w1,$w2,$bl);
		}
	}
	&--dark &__torso {
		@include catTorso($bk2,$bk1);
	}
	&--dark &__input {
		&::-webkit-slider-thumb {
			@include catHead($bk2,$bk1,$gn);
		}
		&::-moz-range-thumb {
			@include catHead($bk2,$bk1,$gn);
		}
	}
}
              
            
!

JS

              
                document.addEventListener("DOMContentLoaded",function(){
	let longcat1 = new LongcatRange("#longcat1"),
		tacgnol1 = new LongcatRange("#tacgnol1",true),
		longcat2 = new LongcatRange("#longcat2"),
		tacgnol2 = new LongcatRange("#tacgnol2",true);
});

class LongcatRange {
	constructor(qs,isDark) {
		this.el = document.querySelector(qs);
		this.sr = null;
		this.fill = null;
		this.value = null;

		if (this.el) {
			this.buildSlider(isDark);
			this.el.addEventListener("input",this.changeValue.bind(this));
		}
	}
	buildSlider(isDark) {
		this.el.className = "longcat__input";
		// create a div to contain the <input> and screen reader label
		let rangeWrap = document.createElement("div");
		rangeWrap.className = "longcat";
		rangeWrap.classList.add(`longcat--${isDark === true ? "dark" : "light"}`);
		this.el.parentElement.insertBefore(rangeWrap,this.el);
		// screen reader label
		this.sr = document.querySelector(`[for='${this.el.id}']`);
		if (this.sr) {
			this.sr.className = "longcat__sr";
			rangeWrap.appendChild(this.sr);
		}
		// input after screen reader label
		rangeWrap.appendChild(this.el);
		// range fill
		let rangeFill = document.createElement("span");
		rangeFill.className = "longcat__torso";
		rangeWrap.appendChild(rangeFill);
		// range value
		let rangeValue = document.createElement("span");
		rangeValue.className = "longcat__value";
		rangeValue.textContent = this.el.value;
		rangeWrap.appendChild(rangeValue);
		// initial value
		this.fill = rangeFill;
		this.value = rangeValue;
		this.changeValue();
	}
	changeValue() {
		// keep the value within range
		if (+this.el.value > this.el.max)
			this.el.value = this.el.max;
		else if (+this.el.value < this.el.min)
			this.el.value = this.el.min;
		// width of fill
		if (this.fill) {
			let pct = (this.el.value - this.el.min) / (this.el.max - this.el.min),
				fillWidth = pct * 100,
				thumbEm = 1,
				thumbEmPct = thumbEm * pct;

			this.fill.style.width = `calc(${fillWidth}% - ${thumbEmPct}em)`;
		}
		// value
		if (this.value)
			this.value.textContent = this.el.value;
	}
}
              
            
!
999px

Console