Blogger Information
Blog 37
fans 0
comment 1
visits 28411
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
HTML 常用表单属性值
kong
Original
362 people have browsed it

参考

https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/Input

  1. input标签 type属性值:
  2. button: 按钮
  3. checkbox: 复选框
  4. radio: 单选
  5. color: 取色器
  6. date: 年、月、日
  7. month: 年和月
  8. time: 只有时间
  9. datetime-local: 日期和时间
  10. email: 邮箱地址
  11. file: 上传文件
  12. hidden: 隐藏不显示
  13. image: 可以加入图片,要有src,alt属性搭配
  14. number: 数字
  15. password: 密码
  16. range: 范围组件
  17. reset: 重置
  18. submit: 提交
  19. search: 搜索
  20. tel: 电话
  21. text: 文本,默认值
  22. url: 支持验证参数
  23. week: 年和周数组成的日期

代码结构

  1. <form action="login.php" method="POST">
  2. <fieldset style="display: inline-grid; gap: 1em">
  3. <legend>账号注册</legend>
  4. <div class="name">
  5. <label for="name">账号</label>
  6. <input
  7. type="text"
  8. placeholder="创建昵称"
  9. name="names"
  10. id="name"
  11. required
  12. autofocus
  13. />
  14. </div>
  15. <div class="name">
  16. <label for="html">html</label>
  17. <input type="checkbox" id="html" name="html" required />
  18. <label for="php">php</label>
  19. <input type="checkbox" id="php" name="php" required />
  20. </div>
  21. <div class="name">
  22. <label for="htmls">html</label>
  23. <input type="radio" id="htmls" name="web" required />
  24. <label for="phps">php</label>
  25. <input type="radio" id="phps" name="web" required />
  26. </div>
  27. <div class="color">
  28. <label for="color">颜色:</label>
  29. <input type="color" name="color" id="color" />
  30. </div>
  31. <div class="date">
  32. <label for="date">年、月、日:</label>
  33. <input type="date" name="date" id="date" />
  34. </div>
  35. <div class="month">
  36. <label for="month">年和月:</label>
  37. <input type="month" name="month" id="month" />
  38. </div>
  39. <div class="time">
  40. <label for="time">时间</label>
  41. <input type="time" name="time" id="time" />
  42. </div>
  43. <div class="time">
  44. <label for="datetime-local">日期和时间</label>
  45. <input
  46. type="datetime-local"
  47. name="datetime-local"
  48. id="datetime_local"
  49. />
  50. </div>
  51. <div class="email">
  52. <label for="email">邮箱:</label>
  53. <input
  54. type="email"
  55. name="email"
  56. id="email"
  57. placeholder="绑定邮箱"
  58. required
  59. />
  60. </div>
  61. <div class="file">
  62. <label for="file">上传文件</label>
  63. <input type="file" name="file" id="file" />
  64. </div>
  65. <div class="file">
  66. <label for="hidden">隐藏</label>
  67. <input type="hidden" name="hidden" id="hidden" />
  68. </div>
  69. <div class="image">
  70. <label for="image">图片</label>
  71. <input type="image" src="" alt="暂无" name="image" id="image" />
  72. </div>
  73. <div class="number">
  74. <label for="number">手机号</label>
  75. <input
  76. type="number"
  77. name="number"
  78. id="number"
  79. placeholder="填写手机号"
  80. />
  81. </div>
  82. <div class="number">
  83. <label for="number">数字</label>
  84. <input type="number" name="number" id="number" />
  85. </div>
  86. <div class="paw">
  87. <label for="password"> 密码: </label>
  88. <input
  89. type="password"
  90. name="password"
  91. placeholder="****"
  92. id="password"
  93. required
  94. />
  95. <button type="button" disabled>显示</button>
  96. </div>
  97. <div class="range">
  98. <label for="range">选取范围</label>
  99. <input type="range" name="range" id="range" />
  100. </div>
  101. <div class="reset">
  102. <label for="reset">重置</label>
  103. <input type="reset" name="reset" value="重置" id="reset" />
  104. </div>
  105. <div class="search">
  106. <label for="search">搜索</label>
  107. <input type="search" name="search" id="search" />
  108. </div>
  109. <div class="tel">
  110. <label for="tel">电话</label>
  111. <input type="tel" name="tel" id="tel" />
  112. </div>
  113. <div class="url">
  114. <label for="url">电话</label>
  115. <input type="url" name="url" placeholder="可以填写参数" id="url" />
  116. </div>
  117. <div class="week">
  118. <label for="week">年和周数组成的日期</label>
  119. <input type="week" name="week" placeholder="可以填写参数" id="week" />
  120. </div>
  121. <button type="submit">登录</button>
  122. </fieldset>
  123. </form>

案例截图

总结

不要忘记标签上的属性,可以带来很多便利之处,具体参考顶部文档链接

Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:不是作业内容可以直接在博客中发布
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!