Created
April 5, 2014 20:07
-
-
Save baniol/9997455 to your computer and use it in GitHub Desktop.
html5 slider range css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment