CSS Stylize input range

4

I need to make an input range for age setting like this:

Ithoughtaboutmakingthe"big" bar with this fixed 20-by-20 range, or a non-fixed bar like in this example , but I'm a beginner and I do not understand what happens, let alone how to change the way age values are displayed. Home Any idea how to do it?

EDIT: If someone can explain the example of the link, thank you very much, especially the stylization of it that I will have to change if it is used.

    
asked by anonymous 08.09.2017 / 14:39

1 answer

0

This is the site code:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Slider - Range slider</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script><scriptsrc="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "#slider-range" ).slider({
      range: true,
      min: 0,
      max: 500,
      values: [ 75, 300 ],
      slide: function( event, ui ) {
        $( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
      }
    });
    $( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) +
      " - $" + $( "#slider-range" ).slider( "values", 1 ) );
  } );
  </script>
</head>
<body>

<p>
  <label for="amount">Price range:</label>
  <input type="text" id="amount" readonly style="border:0; color:#f6931f; font-weight:bold;">
</p>

<div id="slider-range"></div>


</body>
</html>

As I understand it:

      min: 0,
      max: 500,
      values: [ 75, 300 ],

Here you assign the minimum, maximum and default values (value that will appear when the page loads, without the user changing the range)

<input type="text" id="amount" readonly style="border:0; color:#f6931f; font-weight:bold;">

Here is the stylization, border: 0 means it will not have border, color: # f6931f is text color and font-weight: bold applies the effect of bold to text

Note: this example uses inline css, the best would be to use linked css I recommend you read about it

    
12.09.2017 / 21:51