Learn HTML - Range and color inputs

Опубликовано: 05 Март 2023
на канале: Konstantyn's coding
273
2

More on range input: https://developer.mozilla.org/en-US/d...
More on color input: https://developer.mozilla.org/en-US/d...

In this tutorial, we'll discuss two more input types in HTML - 'range' and 'color'. Those are kind of crazy ones, because I didn't use those in any real-world website. Just want to show you that in HTML you have really a lot of input types nowadays. And it is actually a good practice to use native HTML inputs as much as we can and don't rely on JavaScript libraries for every more complicated inputs than text or number.

The 'range' input type is used to create a slider control on a web page. It allows users to select a value within a specified range.

Here, we've set the minimum value to 1 and the maximum value to 10. The user can then slide the slider to choose a value between 1 and 10.

Now, let's talk about the 'color' input type. This input type is used to create a color picker control on a web page. It allows users to select a specific color.

Once the user selects a color, it will be displayed in the input field as a hex code.

It's important to note that not all browsers support the same color formats, so it's a good idea to test your code in multiple browsers.