HTML中的min和max属性用于设置元素的最小值和最大值。min和max属性可用于以下元素:
S. No | Elements | Attribute | Attribute |
1 | <input> | Max | min |
2 | <meter> | Max | min |
3 | <progress> | Max | min |
您可以尝试运行以下代码,以了解如何在HTML中使用min和max属性。
<!DOCTYPE html> <html> <head> <title>HTML min and max attribute</title> </head> <body> <form action = "" method = "get"> Mention any number between 1 to 20 <input type = "number" name="num" min = "1" max = "20"><br> <input type = "submit" value = "Submit"> </form> </body> </html>