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

              
                .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')

              
            
!

CSS

              
                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()

              
            
!

JS

              
                (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

Console