Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding label to the end of HTML Range slider

I'm currently implementing a range slider and have a label at the start of the slider which is positioned just above the slider. This label represents the low end of the scale. Now i need to add a label in the same position at the end of the slider to represent the highest end of the scale. However, i can only get the label to appear at the start of the scale but underneath. I'm using Bootstrap for CSS.

<div class="container">
      <label for="agitated">Agitated</label>
      <input type="range" min="0" max="10" value="5" id="fader">
      </br>

      <label for="happy">Happy</label>
      <input type="range" min="0" max="10" value="5" id="fader">
      </br>

      <label for="tired">Tired</label>
      <input type="range" min="0" max="10" value="5" id="fader">
      </br>

      <label for="scared">Scared</label>
      <input type="range" min="0" max="10" value="5" id="fader">
    </div>
like image 874
xiimoss Avatar asked Jan 17 '26 23:01

xiimoss


2 Answers

Just a heads up for anyone wondering why the answer given by @Denisx isn't working with Bootstrap 4.0 . Use float-left and float-right rather than pull-left and pull-right.

like image 72
Quinn Koike Avatar answered Jan 19 '26 14:01

Quinn Koike


<label for="happy" class="pull-left">Happy</label>
<label for="" class="pull-right">Sad</label>
<input type="range" min="0" max="10" value="5" id="fader">
</br>

Something like this? If thats the points, just use the bootstrap class pull-left and pull-right for each label.

Here is example:

http://jsbin.com/ziluwuv/1/edit?output

like image 21
Expressingx Avatar answered Jan 19 '26 15:01

Expressingx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!