博客列表 >html 表单元素属性与控件

html 表单元素属性与控件

星夜低语
星夜低语原创
2020年04月05日 00:43:46497浏览

点击这里打开本次作业的测试页面,请老师查看,辛苦了

问题

1.老师我的页面背景图片没有平铺整个页面,拉伸和设置背景图大小都没有解决


这个是图片本身不匹配问题还是什么,应该如何调试

测试源码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>表单元素及控件</title>
  7. <style>
  8. body {
  9. width: 100%;
  10. background-image: url(mx.jpg);
  11. background-repeat: no-repeat;
  12. }
  13. form {
  14. padding: 20px;
  15. width: 350px;
  16. box-shadow: 0 0 8px #888;
  17. border-radius: 10px;
  18. box-sizing: border-box;
  19. margin: auto;
  20. background-color: lightskyblue;
  21. display: grid;
  22. gap: 15px;
  23. }
  24. form > section {
  25. display: grid;
  26. grid-template-columns: 60px 1fr;
  27. }
  28. h3 {
  29. text-align: center;
  30. }
  31. input[type="image"] {
  32. justify-self: center;
  33. }
  34. fieldset {
  35. color: #fff;
  36. border-radius: 6px;
  37. border: 2px solid #fff;
  38. margin-top: 18rem;
  39. }
  40. fieldset:hover {
  41. background-color: lightseagreen;
  42. }
  43. fieldset > section {
  44. display: grid;
  45. grid-template-columns: repeat(3, 1fr);
  46. column-gap: 15px;
  47. }
  48. fieldset > legend {
  49. text-align: center;
  50. }
  51. button {
  52. height: 30px;
  53. border: none;
  54. outline: none;
  55. border-radius: 6px;
  56. background-color: rgb(69, 57, 236);
  57. color: white;
  58. }
  59. button:hover {
  60. background-color: darkorchid;
  61. cursor: pointer;
  62. }
  63. </style>
  64. </head>
  65. <body>
  66. <div>
  67. <section style="float: right; margin-right: 8rem;">
  68. <h3>用户注册</h3>
  69. <form
  70. action="register.php"
  71. method="post"
  72. enctype="application/x-www-form-urlencoded"
  73. id="register"
  74. >
  75. <!-- 单行文本输入框 -->
  76. <section>
  77. <label for="email">邮箱:</label>
  78. <!-- 必选且自动获取焦点 -->
  79. <input
  80. type="email"
  81. name="email"
  82. id="email"
  83. maxlength="20"
  84. placeholder="填写正确的邮箱格式"
  85. required
  86. autofocus
  87. />
  88. </section>
  89. <!-- 密码输入框 -->
  90. <section>
  91. <label for="password">密码:</label>
  92. <input
  93. type="password"
  94. name="password"
  95. id="password"
  96. size="10"
  97. placeholder="不少于8位"
  98. required
  99. />
  100. </section>
  101. <!-- 单选框 -->
  102. <section>
  103. <label for="secret">性别:</label>
  104. <div>
  105. <!-- 只允许返回一个值,多个input的name属性值必须相同 -->
  106. <input type="radio" name="gender" id="male" value="male" /><label
  107. for="male"
  108. ></label
  109. >
  110. <input
  111. type="radio"
  112. name="gender"
  113. id="female"
  114. value="female"
  115. /><label for="male"></label>
  116. <!-- checked: 默认选项 -->
  117. <input
  118. type="radio"
  119. name="gender"
  120. id="secret"
  121. value="female"
  122. checked
  123. /><label for="secret">保密</label>
  124. </div>
  125. </section>
  126. <!-- 复选框 -->
  127. <section>
  128. <label for="programme">兴趣:</label>
  129. <div>
  130. <!-- 允许返回多个值,属性名采用数组格式,便于后端处理 -->
  131. <input type="checkbox" name="hobby[]" id="game" checked /><label
  132. for="game"
  133. >游戏</label
  134. >
  135. <input type="checkbox" name="hobby[]" id="travel" checked /><label
  136. for="travel"
  137. >旅游</label
  138. >
  139. <input
  140. type="checkbox"
  141. name="hobby[]"
  142. value="shoot"
  143. id="shoot"
  144. /><label for="shoot">摄影</label>
  145. <input
  146. type="checkbox"
  147. name="hobby[]"
  148. value="programme"
  149. id="programme"
  150. checked
  151. /><label for="programme">编程</label>
  152. </div>
  153. </section>
  154. <!-- 文件域 -->
  155. <section>
  156. <label for="userpic">头像:</label>
  157. <!-- 设置<form enctype="multipart/form-data">,且为POST提交 才有效-->
  158. <input type="file" name="user_pic" id="userpic" />
  159. <!-- 隐藏域: 限制上传文件大小不超过8M -->
  160. <input type="hidden" name="MAX_FILE_SIZE" value="8388608" />
  161. </section>
  162. <!-- 预定义复合框 -->
  163. <section>
  164. <label for="course">课程:</label>
  165. <input type="text" name="course" list="course" />
  166. <datalist id="course">
  167. <!-- 此<option>使用单标签,与<select>中不同 -->
  168. <option value="HTML/CSS开发与实战"> </option>
  169. <option value="JavaScript基础与实战"> </option>
  170. <option value="PHP开发基础"> </option>
  171. <option value="Laravel基础与实战"> </option>
  172. </datalist>
  173. </section>
  174. <!-- 当前默认选项值是"CSS3", 点击CSS3不会触发change事件,除此之外都会触发 -->
  175. <!-- click事件不在乎当前值是否发生变化, 只要点击一定触发, 注意与change事件的区别 -->
  176. <select
  177. name="lang"
  178. id="lang"
  179. size="8"
  180. multiple
  181. onchange="alert(this.value)"
  182. >
  183. <optgroup label="前端">
  184. <option value="html5">HTML5</option>
  185. <option value="css3" selected>CSS3</option>
  186. <option value="javascript" disabled>JavaScript</option>
  187. <!-- 使用label属性,可省略选项文本,并将option转为单标签 -->
  188. <option value="es6" label="ECMScript6"> </option
  189. ><option value="jquery" label="jQuery"> </option
  190. ></optgroup>
  191. <optgroup label="后端">
  192. <option value="php" label="PHP"> </option
  193. ><option value="mysql" label="MySQL"> </option
  194. ><option value="javascript" label="Laravel"> </option
  195. ></optgroup>
  196. </select>
  197. <textarea
  198. name="reply"
  199. id=""
  200. cols="20"
  201. rows="5"
  202. minlength="5"
  203. maxlength="50"
  204. form="register"
  205. placeholder="随便写点对自己想说的吧,不超过50字符"
  206. onchange="alert('给梦想一个机会加油哦~')"
  207. onselect="this.style.color='red'"
  208. ></textarea>
  209. <!-- 图像域: 提交按钮为图像 -->
  210. <!-- 返回点击图片的x/坐标,推荐加上name属性,返回有语义坐标 -->
  211. <!-- 测试提交,启动一个本地Web服务器: php -S localhost:8888 -->
  212. <input
  213. type="image"
  214. src="btn.png"
  215. alt="submit"
  216. name="submit"
  217. width="100"
  218. />
  219. <button type="reset">重置</button>
  220. </form>
  221. </section>
  222. <section style="overflow: hidden;">
  223. <!-- 表单域分组2 -->
  224. <fieldset name="other" form="register">
  225. <legend>选填信息</legend>
  226. <section>
  227. <input
  228. type="text"
  229. name="nickname"
  230. placeholder="您的呢称"
  231. form="register"
  232. />
  233. <input type="number" name="age" min="10" max="70" step="1"
  234. form="register" / placeholder="您的年龄"> <input type="url"
  235. name="site" placeholder="个人站点"" form="register" /><br />
  236. </section>
  237. </fieldset>
  238. </section>
  239. </div>
  240. </body>
  241. </html>
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议