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

              
                <div class="range">
    <span class="lbl-lft">0</span>
    <span class="lbl-rgt">100</span>
    <input type="range" id="range-input" oninput="updateVal(this.value)"/>
    <div id="range-value" class="range-thumb"></div>
  </div>

  <div class="resize">Resize to width = 768px for fluid slider</div>
              
            
!

CSS

              
                $primary: #626CE4

body
  font-family: 'Roboto', sans-serif
  -webkit-font-smoothing: antialiased
  text-rendering: optimizelegibility

*,
*::before,
*::after
  box-sizing: border-box

.range
  width: 234px
  height: 48px
  border: 0
  background: $primary
  position: absolute
  top: 45%
  left: 50%
  margin-left: -117px
  &:before, &:after
    content: ''
    position: absolute
    top: 0
    z-index: -1
    height: 100%
    width: 28px
    background: $primary
    pointer-events: none
  &:before
    left: -28px
    border-radius: 5px 0 0 5px
  &:after
    right: -28px
    border-radius: 0 5px 5px 0
  input
    -webkit-appearance: none
    position: absolute
    width: calc(100% + 40px)
    height: 100%
    margin: 0
    background-color: transparent
    outline: none
    left: -20px
    -webkit-tap-highlight-color: transparent
    &::-webkit-slider-thumb,
    &::-webkit-media-slider-thumb
      opacity: 0
    &:hover + .range-thumb,
    &:active + .range-thumb
      @media screen and (max-width: 768px)
        transform: translateY(-48px)
      &::before
        display: block

.lbl-lft,.lbl-rgt
  position: absolute
  top: -15px
  color: #1a1a1a
  font-size: 12px
  font-weight: 700
.lbl-lft
  left: -28px
.lbl-rgt
  right: -28px
  text-align: left

.range-thumb
  position: absolute
  top: 0px
  margin-left: -24px
  border-radius: 50%
  border: 5px solid $primary
  background: white
  height: 48px
  width: 48px
  outline: none
  transition: transform .3s ease
  text-align: center
  font-size: 12px
  line-height: 38px
  color: #1a1a1a
  font-weight: 700
  pointer-events: none
  &::before
    display: none
    content: ''
    position: absolute
    z-index: 1
    top: 53px
    left: 50%
    transform: translateX(-50%)
    border-radius: 3px
    width: 2px
    height: 28px
    margin-left: -3px
    background: rgba(white,.25)
    box-shadow: 6px 0 0 rgba(white,.25)
  &::after
    content: ''
    position: absolute
    bottom: -5px
    left: -5px
    width: 48px
    height: 10px
    background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDhweCIgaGVpZ2h0PSIxMHB4IiB2aWV3Qm94PSIwIDAgNDggMTAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ3ICg0NTM5NikgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+Q29tYmluZWQgU2hhcGU8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iQXJ0Ym9hcmQiIGZpbGw9IiM2MTY4RTciPgogICAgICAgICAgICA8cGF0aCBkPSJNMTEuMTU0NjA2NCwyLjE4MjkyMDUxZS0xMiBMNC40NzIyMTMwMSwyLjE4MjkyMDUxZS0xMiBDNS40MjIyOTI4NiwxLjA2MTUxMjk4IDYsMi40NjMyOTExMyA2LDQgQzYsNy4zMTM3MDg1IDMuMzEzNzA4NSwxMCAwLDEwIEw0OCwxMCBDNDQuNjg2MjkxNSwxMCA0Miw3LjMxMzcwODUgNDIsNCBDNDIsMi40NjMyOTExMyA0Mi41Nzc3MDcxLDEuMDYxNTEyOTggNDMuNTI3Nzg3LDAgTDQzLjUyNzc4NywyLjE4MjkyMDUxZS0xMiBMMzYuODQ1MzkzNiwyLjE4MjkyMDUxZS0xMiBDMzMuNDYzMzI1NSwzLjEwNDc5MzA5IDI4Ljk1Mjk4NzQsNSAyNCw1IEMxOS4wNDcwMTI2LDUgMTQuNTM2Njc0NSwzLjEwNDc5MzA5IDExLjE1NDYwNjQsMi4xOTQyNDQ3OWUtMTIgWiIgaWQ9IkNvbWJpbmVkLVNoYXBlIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=')
    background-repeat: no-repeat
    background-position: center

.resize
  position: fixed
  bottom: 20px
  left: 0
  width: 100%
  text-align: center
  font-size: 14px
  font-weight: 500
  color: #C8CCD4
              
            
!

JS

              
                var rangeVal = document.getElementById('range-value');
var rangeInp = document.getElementById('range-input');

var updateVal = function(val) {
  rangeVal.innerHTML = val;
  rangeVal.style.left = val + '%';
};

updateVal(rangeInp.value);
              
            
!
999px

Console