How to add a float input in HTML5?

Spread the love

Sometimes, we want to add a float input in HTML5.

In this article, we’ll look at how to add a float input in HTML5.

How to add a float input in HTML5?

To add a float input in HTML5, we add the step attribute to our input.

For instance, we write

<input type="number" step="0.01" />

to add the step attribute and set it to 0.01.

This will make the input accept number values with 2 decimal places.

Conclusion

To add a float input in HTML5, we add the step attribute to our input.

Leave a Reply

Your email address will not be published. Required fields are marked *