You enter 2.5 into a form and the browser says the value is invalid. The problem may be the permitted step, not your ability to type a decimal. Numeric fields can restrict values by minimum, maximum, and step.
MDN’s number-input documentation explains these constraints. For a basic number input, the default step is 1; the valid sequence also depends on the step base. Forms that accept arbitrary decimals can specify an appropriate step or use step=”any”.
A small example
Suppose a quantity field is configured with a minimum of 0 and a step of 0.5. Values such as 0, 0.5, 1, and 1.5 fit that sequence. A value of 1.2 does not. This is an illustrative configuration, not a universal rule for all quantity forms.
As a visitor, read the unit and help text before changing your answer. Do not round a measurement simply to silence an error when that would make the submitted value wrong. Report the rejected value and expected unit to the site operator without including private form details.
As a form author, align the step with the actual requirement and test both valid and invalid examples. Browser validation improves feedback, but server-side validation is still necessary.
A precise instruction such as “Enter weight in kilograms, in increments of 0.5” makes the rule understandable before the visitor encounters an error.
A three-value check for the form author
For the illustrative half-kilogram rule, test 1, 1.5 and 1.2. The first two should satisfy the step constraint; the last should not. Then test an empty value separately, because whether the field is required is a different rule from which numeric increments it accepts.
Keep the error message tied to the violated rule. “Use steps of 0.5 kg” tells the visitor more than “invalid number.” If the business requirement actually permits 1.2 kg, correct the form configuration and its server-side rule rather than asking the visitor to submit a false measurement.

