Blogger Information
Blog 3
fans 0
comment 0
visits 2629
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
一个没有JS跟没有连接数据库的表单
华强
Original
463 people have browsed it

下面是我对基本选择器与上下文显示器的理解与实例。


这是我对基本选择器的实例(理解写在文档的注释里)。

  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>基本选择器实例</title>
  8. <style type="text/css">
  9. /* 1:基于标签选择 */
  10. ul {
  11. color: greenyellow;
  12. }
  13. /* 2:基于标签内的属性来选择
  14. class属性的快捷方式是'.' */
  15. .red{
  16. color: orangered;
  17. }
  18. /* id属性的快捷方式是'#' */
  19. #blue{
  20. color: cadetblue;
  21. }
  22. </style>
  23. </head>
  24. <body>
  25. <ul>
  26. <li class="red">demo22</li>
  27. <li class="red">demo33</li>
  28. <li>demo44</li>
  29. <li>demo55</li>
  30. <li id="blue">demo66</li>
  31. <li id="blue">demo77</li>
  32. </ul>
  33. </body>
  34. </html>

这是效果图


这是我对上下文选择器的实例(理解写在文档的注释里)。

  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>上下文选择器实例</title>
  8. <style type="text/css">
  9. /* 1:后代全选,变相理解就是win系统里的'control+a’.他的快捷方式是空格键 */
  10. li {
  11. background-color: #FF4500;
  12. }
  13. /* 2:子选择器,只选中子一级,下面的儿子孙子都不会被选中. 他的快捷方式是'>' */
  14. body>ul>li{
  15. background-color: blueviolet;
  16. }
  17. /* 3:同级相邻选择器,选中的是下面一个同级的来操作,他的快捷方式是'+' */
  18. .tongji+li{
  19. background-color: cadetblue;
  20. }
  21. /* 4:同级全部选择器,选中的是同级全部,但不包括儿子孙子,快捷方式是'~' */
  22. .all~li{
  23. background-color: deeppink;
  24. }
  25. </style>
  26. </head>
  27. <body>
  28. <ul>
  29. <li class="all">demo2222</li>
  30. <li>demo3333</li>
  31. <li>demo4444</li>
  32. <ul>
  33. <li class="tongji">demo11111</li>
  34. <li>demo22222</li>
  35. <li>demo33333</li>
  36. </ul>
  37. <li>demo5555</li>
  38. <li>demo6666</li>
  39. <li>demo7777</li>
  40. </ul>
  41. </body>
  42. </html>

这是效果图


下面是我仿照老师写的表单以及效果图。

  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>用户注册</title>
  8. </head>
  9. <h1 align="center">用户注册</h1>
  10. <body>
  11. <form action="" method="get">
  12. <fieldset id="">
  13. <legend align="center">欢迎您的加入</legend>
  14. <br>
  15. <div>
  16. <label for="username">账户:</label>
  17. <input type="text" placeholder="请输入预想的用户名" id="username">
  18. </div>
  19. </div>
  20. <label for="password">密码:</label>
  21. <input type="password" placeholder="请输入预想的密码" id="password">
  22. </div>
  23. <div>
  24. <label for="phone">电话:</label>
  25. <input type="number" placeholder="请输入您的手机号" id="phone">
  26. </div>
  27. <br>
  28. <div>
  29. <label for="">您的性别:</label>
  30. <input type="radio" name="xingbie" id="" value="man" /> <label></label>
  31. <input type="radio" name="xingbie" id="" value="girl" /> <label></label>
  32. </div>
  33. <br>
  34. <div>
  35. <label>爱吃的主食:</label>
  36. <input type="checkbox" name="zhushi[]" id="" value="mifan" /> <label>米饭</label>
  37. <input type="checkbox" name="zhushi[]" id="" value="miantiao" /> <label>面条</label>
  38. <input type="checkbox" name="zhushi[]" id="" value="jiaozi" /> <label>饺子</label>
  39. </div>
  40. <br>
  41. <div>
  42. <label>请选择您需要注册的会员等级:</label><select name="vip">
  43. <option value="putong">普通会员</option>
  44. <option value="zhongji">中级会员</option>
  45. <option value="gaoji">高级会员</option>
  46. </select>
  47. </div>
  48. <br>
  49. <div>
  50. <label>请输入您的职业:</label>
  51. <input type="search" name="search" id="" value="" list="keywords"/>
  52. <datalist id="keywords">
  53. <option value ="学生"></option>
  54. <option value ="老师"></option>
  55. <option value ="医生"></option>
  56. <option value ="会记"></option>
  57. <option value ="律师"></option>
  58. <option value ="个体"></option>
  59. </datalist>
  60. </div>
  61. </fieldset>
  62. </form>
  63. <br>
  64. <button type="button" style="width: 600px;" >点击注册</button>
  65. </body>
  66. </html>

Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:关于后代选择器,可以理解为windows系统内一个文件夹内进行ctrl + a
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