This HTML and CSS code helps you to create a vertical range slider. It allows users to select a value within a specified range by sliding a thumb up and down. The slider comes with a unique appearance and user-friendly interface. This code is helpful for creating interactive interfaces with vertical range selection.
You can use this code to create vertical range sliders for customizing product filters, adjusting settings, or creating interactive data visualization tools.
How to Create Vertical Range Slider Using HTML CSS
1. Start by creating an HTML file and adding the necessary structure. The following code includes a basic HTML structure with two range sliders inside div elements. You can customize the min, max, and step attributes to fit your specific needs.
<div class="wrapper"> <input type="range" min="0" max="100" value="50" /> </div> <div class="wrapper"> <input type="range" min="0" max="100" value="50" step="12.5" /> </div>
2. The CSS code included in the example enhances the visual appeal of the range sliders. It defines the appearance, positioning, and styling of the sliders. You can modify the CSS to match your website’s design or create a unique look.
@charset "UTF-8"; * { box-sizing: border-box; margin: 0; padding: 0; } body { min-height: 100vh; margin: 0 auto; background-color: #05051a; display: grid; grid-template-columns: 1fr 1fr; place-items: center; } .wrapper { position: relative; height: 20rem; width: 3rem; } .wrapper::before, .wrapper::after { display: block; position: absolute; z-index: 99; color: #fff; width: 100%; text-align: center; font-size: 1.5rem; line-height: 1; padding: 0.75rem 0; pointer-events: none; } .wrapper::before { content: "+"; } .wrapper::after { content: "−"; bottom: 0; } input[type=range] { -webkit-appearance: none; background-color: rgba(255, 255, 255, 0.2); position: absolute; top: 50%; left: 50%; margin: 0; padding: 0; width: 20rem; height: 3.5rem; transform: translate(-50%, -50%) rotate(-90deg); border-radius: 1rem; overflow: hidden; cursor: row-resize; } input[type=range][step] { background-color: transparent; background-image: repeating-linear-gradient(to right, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2) calc(12.5% - 1px), #05051a 12.5%); } input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 0; box-shadow: -20rem 0 0 20rem rgba(255, 255, 255, 0.2); } input[type=range]::-moz-range-thumb { border: none; width: 0; box-shadow: -20rem 0 0 20rem rgba(255, 255, 255, 0.2); }
Feel free to customize the code further to suit your project. You can change colors, sizes, and other CSS properties to match your website’s style.
That’s all! hopefully, you have successfully created a Vertical Range Slider in your web/app project. If you have any questions or suggestions, feel free to comment below.
Similar Code Snippets:
I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences.
I truly enjoy what I’m doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.