baniol
4/5/2014 - 8:07 PM

html5 slider range css

html5 slider range css

<!DOCTYPE html>
<html>
<head>
  <title></title>
  <style>
    body {
      padding-top: 200px;
    }
    input::after {
      content: attr(data-value) '/' attr(max);
      position: relative;
      left: 135px; top: -20px;
    }
  </style>
</head>
<body>
  <h2>from: http://www.htmlfivecan.com/#23</h2>
  <input type="range" min="0" max="100" value="25">
  <script>
    var input = document.querySelector('input');
    input.dataset.value = input.value; // Set an initial value.

    input.addEventListener('change', function(e) {
      this.dataset.value = this.value;
    });
  </script>

</body>
</html>