The Wayback Machine - https://web.archive.org/web/20240118171447/https://www.geeksforgeeks.org/bootstrap-5-range/
Open In App
Related Articles

Bootstrap 5 Range

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

Bootstrap 5 Range is the limit slider between values that can vary. Bootstrap provides us with a custom range of inputs that provides consistent cross-browser styling. The value and background for the range slider are both styled to look the same across all other browsers.

  • Disabled: It is grayed out in appearance and the pointer does not slide as the pointer events are disabled.
  • Min and Max: It has implicit values 0 – 100 for min and max respectively which can be changed by specifying new values for min and max attributes.
  • Steps: The range inputs are only integer values, to change this we need to specify a step value which can be either a decimal value or an integer value.

Example 1: Custom Range and Disabled Range are depicted in this example. class”w-50″ added to give width to the range input.

HTML




<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" 
          content="IE=edge">
    <meta name="viewport" 
          content="width=device-width, initial-scale=1.0">
    <link href=
          rel="stylesheet">
</head>
  
<body>
    <div class="text-center">
        <h1 class="text-success">
            GeeksforGeeks
        </h1>
        <h2>Bootstrap5 Range</h2>
        <br><br>
        <h6>Custom Range</h6>
        <input type="range" class="form-range w-50">
        <br>
        <h6>Disabled Range</h6>
        <input type="range" class="form-range w-50" 
               disabled>
    </div>
</body>
</html>


Output:

 

Example 2: Min Max range and step range are depicted in this example. Between Min as ‘0’ and Max as ‘5’ we have 5 intermediate stops but by using the step as 0.5 it becomes 10.

HTML




<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" 
          content="IE=edge">
    <meta name="viewport" 
          content="width=device-width, initial-scale=1.0">
    <link href=
          rel="stylesheet">
</head>
  
<body>
    <div class="text-center">
        <h1 class="text-success">
            GeeksforGeeks
        </h1>
        <h2>Bootstrap5 Range</h2>
        <br><br>
        <h6>Min Max Range</h6>
        <input type="range" class="form-range w-50" 
               min="0" max="5"><br>
        <h6>Steps</h6>
        <input type="range" class="form-range w-50" 
               min="0" max="5" step="0.5">
    </div>
</body>
</html>


Output:

 

References: https://getbootstrap.com/docs/5.0/forms/range/


Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated : 16 Dec, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads
Complete Tutorials