programming-examples/html/Basics/Creating HTML5 number input type.html

22 lines
630 B
HTML
Raw Permalink Normal View History

2019-11-18 14:44:36 +01:00
<!DOCTYPE html>
<html subLang="en">
<head>
<title>HTML5 Number Input Type</title>
<style type="text/css">
input[type="number"]:valid{
outline: 2px solid green;
}
input[type="number"]:invalid{
outline: 2px solid red;
}
</style>
</head>
<body>
<form>
<label>
Select Number: <input type="number" value="1" min="1" max="10" step="0.5" name="mynumber">
</label>
</form>
<p><strong>Note</strong>: If you try to enter the number out of the range (1-10) or text character it will show error.</p>
</body>
</html>