HTML5 新表单类型示例代码
- 作者: Super--爺
- 来源: 51数据库
- 2021-09-03
demo.html:
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>document</title> <style> form { width: 100%; max-width: 640px; min-width: 320px; margin: 0 auto; font-family: "microsoft yahei"; font-size: 20px; } input { display: block; width: 100%; height: 30px; margin: 10px 0; } </style> </head> <body> <form action=""> <fieldset> <legend>表单属性</legend> <label for=""> email: <input type="email" name="email" > </label> <label for=""> tel: <input type="tel" name="tel" > <!-- 本身不验证,自己添加验证 --> </label> <label for=""> url: <input type="url" name="url" > </label> <label for=""> number: <input type="number" name="number" step="5"> <!--输入的是步长的整倍数--> </label> <label for=""> search: <input type="search" name="search" > <!--移动端出现的小键盘右下角是搜索按钮--> </label> <label for=""> range: <input type="range" name="range" value="100" min="0" max="300"> <!--默认最小0 最大100--> </label> <label for=""> <label for=""> color: <input type="color" name="color" > </label> time: <input type="time" name="time" > </label> <label for=""> date: <input type="date" name="date" > </label> <label for=""> month: <input type="month" name="month" > </label> <label for=""> week: <input type="week" name="week" > </label> <label for=""> datetime: <input type="datetime" name="datetime" > </label> <input type="submit" value="提交"> </fieldset> </form> </body> </html>
总结
以上所述是小编给大家介绍的html5 新表单类型示例代码,希望对大家有所帮助
推荐阅读