css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

            
              .range-slider

	span from
		input(type='number', value='25000', min='0', max='120000')
		|	to
		input(type='number', value='50000', min='0', max='120000')
	
	input(value='25000', min='0', max='120000', step='500', type='range')
	input(value='50000', min='0', max='120000', step='500', type='range')

	svg(width='100%', height='24')
		line(x1='4', y1='0', x2='300', y2='0', stroke='#444', stroke-width='12', stroke-dasharray='1 28')

            
          
!
            
              body
	display flex
	height 100vh

input
	box-shadow 0
	outline 0


.range-slider
	//tpl
	width 300px
	margin auto
	text-align center
	
	position relative
	height 6em
	
	svg
	input[type=range]
		position absolute
		left 0
		bottom 0

	
input[type=number]
	//width 33%
	border 1px solid #DDD
	text-align center
	font-size 1.6em
	-moz-appearance: textfield
	&::-webkit-outer-spin-button,
	&::-webkit-inner-spin-button
		-webkit-appearance none
	&:invalid
	&:out-of-range
		border 2px solid tomato


input[type=range]
	-webkit-appearance none
	width 100%

input[type=range]:focus
	outline none
	&::-webkit-slider-runnable-track
		background #2497E3
	&::-ms-fill-lower
		background #2497E3
	&::-ms-fill-upper
		background #2497E3

		
track()
	width 100%
	height 5px
	cursor pointer
	animate 0.2s

styl_track()
	background #2497E3
	border-radius 1px
	box-shadow none
	border 0

thumb()
	z-index 2
	position relative
	box-shadow 0px 0px 0px #000
	border 1px solid #2497E3
	height 18px
	width 18px
	border-radius 25px
	background #A1D0FF
	cursor pointer

input[type=range]::-webkit-slider-runnable-track
	track()
	styl_track()
input[type=range]::-webkit-slider-thumb
	thumb()
	-webkit-appearance none
	margin-top -7px

input[type=range]::-moz-range-track
	track()
	styl_track()

input[type=range]::-moz-range-thumb
	thumb()

input[type=range]::-ms-track
	track()
	background transparent
	border-color transparent
	color transparent
input[type=range]::-ms-fill-lower
input[type=range]::-ms-fill-upper
	styl_track()
input[type=range]::-ms-thumb
	thumb()

            
          
!
            
              (function() {

  var parent = document.querySelector(".range-slider");
  if(!parent) return;

  var
    rangeS = parent.querySelectorAll("input[type=range]"),
    numberS = parent.querySelectorAll("input[type=number]");

  rangeS.forEach(function(el) {
    el.oninput = function() {
      var slide1 = parseFloat(rangeS[0].value),
        	slide2 = parseFloat(rangeS[1].value);

      if (slide1 > slide2) {
				[slide1, slide2] = [slide2, slide1];
        // var tmp = slide2;
        // slide2 = slide1;
        // slide1 = tmp;
      }

      numberS[0].value = slide1;
      numberS[1].value = slide2;
    }
  });

  numberS.forEach(function(el) {
    el.oninput = function() {
			var number1 = parseFloat(numberS[0].value),
					number2 = parseFloat(numberS[1].value);
			
      if (number1 > number2) {
        var tmp = number1;
        numberS[0].value = number2;
        numberS[1].value = tmp;
      }

      rangeS[0].value = number1;
      rangeS[1].value = number2;

    }
  });

})();
            
          
!
999px
🕑 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.
Loading ..................

Console