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.


                <!-- practice walkthrough from codeplayer -->
<!-- -->

<h1>Spicing up the HTML5 range slider input</h1>
<div id="input-wrapper">
	<!-- The step param prevents snapping of the slider -->
	<!-- oninput triggers while dragging -->
	<!-- onchange triggers when the user leaves the mousehold -->
	<!-- onmouseup is a fallback for onchange which might not trigger if the value before and after a drag is same -->
	<input type="range" id="rangeslider" min="0" max="30" value="20" step="0.05" 
	oninput="updateOutput(value, true)" 
	<!-- The reel -->
	<div id="reel">
		<!-- reel numbers - will be populated by JS -->
		<div id="rn"></div>
	<!-- static output display on the slider thumb - controlled by JS -->
	<div id="static-output"></div>

<!-- jQuery -->
<script type="text/javascript" src=""></script>



                /*Sniglet and Oswald custom fonts*/
@import url("|Oswald");
/*basic reset and general styles*/
* {margin: 0; padding: 0;}
body {padding-top: 50px; background: hsl(175, 30%, 30%);}
h1 {
	font: normal 36px Sniglet; color: white;
	padding: 50px; text-align: center;
	Rangeslider width = 400px
	Track height = 5px
	Slider thumb height = 25px(5px over the track, 10px above and below)
	Reel width/height = 54px = slider thumb width = static output width
#input-wrapper {
	width: 400px; margin: 0 auto;
	position: relative;
	/*padding: 54px on top for #reel, 10px on top/bottom for slider thumb*/
	padding-top: 64px;
	padding-bottom: 10px;
	/*To hide the extra portion of the completed track on the left*/
	overflow-x: hidden;
#rangeslider {
	display: block; appearance: none; outline: none;
	height: 5px; width: 100%;
	background: rgba(0, 0, 0, 0.3);
#rangeslider::-webkit-slider-thumb {
	appearance: none; cursor: pointer;
	height: 5px; width: 54px;
	position: relative;
#rangeslider::-webkit-slider-thumb:after {
	content: '< >'; word-spacing: 20px; text-align: center;
	background: hsl(140, 50%, 70%);
	font: bold 17px/25px Sniglet; color: white;
	width: 54px; height: 25px;
	position: absolute; top: -10px; left: 0;
	color: transparent; transition: color 0.25s;
/*completed part of the track on the left side*/
#rangeslider::-webkit-slider-thumb:before {
	content: '';
	height: 5px; width: 400px;
	position: absolute; top: 0; right: 0;
	background: hsl(140, 50%, 70%);
	/*prevent click obstruction for the real slider track beneath*/
	pointer-events: none;
/*reel styles*/
#reel {
	width: 54px; height: 54px;
	overflow: hidden;
	position: absolute; top: 0; /*left pos will be controlled by JS*/
	opacity: 0; transition: opacity 0.25s;
#rn {
	background: linear-gradient(hsl(0, 80%, 70%), hsl(120, 80%, 70%));
	transition: all 0.25s; /*vertical movement animation for the reel*/
#rn span {
	font: 30px/54px Oswald; color: white;
	display: block; text-align: center;
/*static output styles*/
#static-output {
	font: bold 17px/25px Sniglet; color: white;
	position: absolute; bottom: 0;
	height: 25px; width: 54px; text-align: center;
	/*disable clicks so that the slider thumb can be controlled*/
	pointer-events: none;
	transition: color 0.25s;

/*animation styles using .active. The reel and arrows will stay hidden by default. On user activity the static output will fade away and the reel and arrows will fade in*/
.active #reel {opacity: 1;}
.active #static-output {color: transparent;}
.active #rangeslider::-webkit-slider-thumb:after {color: white;}



                //lets populate reel numbers
var min = $("#rangeslider").attr("min");
var max = $("#rangeslider").attr("max");

var rn = "";
for(var i = min; i <= max; i++)
	rn += "<span>"+i+"</span>";

//triggering updateOutput manually
updateOutput($("#rangeslider").val(), false);

var rfigure, h, v;
//lets display the static output now
function updateOutput(figure, activate) {
	//if activate then add .active to #input-wrapper to help animate the #reel
	//because of the step param the slider will return values in multiple of 0.05 so we have to round it up
	rfigure = Math.round(figure);
	//displaying the static output
	//positioning #static-output and #reel
	//horizontal positioning first
	h = figure/max*($("#input-wrapper").width()-$("#reel").width()) + 'px';
	//vertical positioning of #rn
	v = rfigure*$("#reel").height()*-1 + 'px';
	//applying the positions
	$("#static-output, #reel").css({left: h});
	//#rn will be moved using transform+transitions for better animation performance. The false translateZ triggers GPU acceleration for better performance.
	$("#rn").css({transform: 'translateY('+v+') translateZ(0)'});
function deactivate() {
	//remove .active from #input-wrapper