22 lines
630 B
HTML
22 lines
630 B
HTML
|
<!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>
|