Blogger Information
Blog 8
fans 0
comment 0
visits 3694
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
表单+简单后台架构+元素样式来源与优先级
平凡之路
Original
422 people have browsed it

一、表单


1.登录表单

代码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <title>登录表单</title>
  8. </head>
  9. <body>
  10. <div
  11. style="
  12. height: 50px;
  13. background-color: rgb(8, 139, 226);
  14. text-align: center;
  15. color: rgb(233, 233, 233);
  16. "
  17. >
  18. <h1>登录表单</h1>
  19. </div>
  20. <div
  21. style="
  22. text-align: center;
  23. margin: auto;
  24. width: auto;
  25. height: 850px;
  26. padding-top:300px
  27. background-color: rgb(241, 241, 241);
  28. "
  29. >
  30. <div>
  31. <br /><br /><br /><br /><br /><br />
  32. <br /><br /><br /><br /><br /><br />
  33. <form action="">
  34. <label for="name">登录账号:</label>
  35. <input
  36. type="text"
  37. id="name"
  38. name="name"
  39. value=""
  40. placeholder="请输入账号"
  41. autofocus
  42. required
  43. />
  44. </div>
  45. <div>
  46. <label for="password">登录密码:</label>
  47. <input
  48. type="password"
  49. id="name"
  50. name="name"
  51. value=""
  52. placeholder="至少8位数"
  53. autofocus
  54. required
  55. />
  56. </div>
  57. <div>
  58. <label for="password"
  59. >邮箱 :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label
  60. >
  61. <input
  62. type="password"
  63. id="name"
  64. name="name"
  65. value=""
  66. placeholder="xxxx@xx.com"
  67. autofocus
  68. required
  69. />
  70. <br /><br />
  71. </div>
  72. <div><button style="height: 40px; width: 100px">登录</button></div>
  73. </div>
  74. </form>
  75. <div style="background-color: rgb(8, 139, 226); height: 50px"></div>
  76. </body>
  77. </html>

示例效果展示

2.单选、复选、下拉列表、文本域表单

代码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <title>问卷调查</title>
  8. </head>
  9. <body>
  10. <div
  11. style="
  12. height: 50px;
  13. background-color: rgb(8, 139, 226);
  14. text-align: center;
  15. color: rgb(233, 233, 233);
  16. ">
  17. <!-- 头部 -->
  18. <h1>问卷调查</h1>
  19. </div>
  20. <!-- 中间 -->
  21. <div
  22. style="
  23. text-align: left;
  24. margin: auto;
  25. width: auto;
  26. height: 850px;
  27. padding-top:300px
  28. background-color: rgb(241, 241, 241);
  29. "
  30. >
  31. <div>
  32. <br /><br />
  33. <!-- 中间内容 -->
  34. <form action="">
  35. <div>
  36. <label for="women" >1. 你的性别&nbsp;&nbsp;&nbsp;</label><br>
  37. <!-- name=""属性必须一样 type=radio 这样才为单选 -->
  38. <input type="radio" name="gender" id="men"/><label for="men"></label>
  39. <input type="radio" name="gender" id="women" checked /><label for="women"></label>
  40. </div><br>
  41. <div>
  42. <label for="rad">2. 你最喜欢的运动(单选)</label><br>
  43. <input type="radio" name="gender" id=""/><label for="men">爬山</label>
  44. <input type="radio" name="gender" id="rad" checked/><label for="men">骑自行车</label>
  45. <input type="radio" name="gender" id=""/><label for="men">游泳</label>
  46. </div><br>
  47. <div>
  48. <label for="rad">3. 你最喜欢吃的水果(多选)</label><br>
  49. <input type="checkbox" name="gender1" id=""/><label for="men">西瓜</label>
  50. <input type="checkbox" name="gender2" id="" /><label for="men">菠萝</label>
  51. <input type="checkbox" name="gender3" id="rad" checked/><label for="men">苹果</label>
  52. <input type="checkbox" name="gender3" id="rad" checked/><label for="men">梨子</label>
  53. <div><br>
  54. <label for="user">4. 你的年龄:</label>
  55. <select name="" id="user">
  56. <option value="1">10-20岁</option>
  57. <option value="2">20-30岁</option>
  58. <option value="3" selected >30-40岁</option>
  59. <option value="4" >40-50岁</option>
  60. </select>
  61. </div>
  62. <div><br>
  63. <label for="zzz">5. 投诉与建议</label>
  64. <br>
  65. <!-- 多行文本域 -->
  66. <textarea name="" id="zzz" cols="30" rows="10" required></textarea>
  67. </div>
  68. </div><br>
  69. <div></div>
  70. </div>
  71. <div><button style="height: 40px; width: 100px">提交</button></div>
  72. </div>
  73. </form>
  74. <!-- 底部 -->
  75. <div style="background-color: rgb(8, 139, 226); height: 50px"></div>
  76. </body>
  77. </html>

示例效果展示

二、后台简单架构

代码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <title>后台架构</title>
  8. </head>
  9. <body>
  10. <div
  11. style="
  12. height: 50px;
  13. background-color: rgb(8, 139, 226);
  14. text-align: center;
  15. color: rgb(233, 233, 233);
  16. "
  17. >
  18. <!-- 头部 -->
  19. <h1>后台架构</h1>
  20. </div>
  21. <!-- 中间 -->
  22. <div style="background-color: rgb(241, 241, 240); height: 840px">
  23. <!-- <a href="https://www.ifeng.com/" target="content">凤凰网</a>
  24. <iframe src="" frameborder="1" name="content"></iframe> -->
  25. <!-- 后台顶部 -->
  26. <div class="header">
  27. <br />
  28. <b>后台管理</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  29. <span>amin</span><a href="">退出</a>
  30. <hr />
  31. <div></div>
  32. <!-- 左侧导航 -->
  33. <div>
  34. <ul class="class">
  35. <!-- li*5>a[herf='demo$ target="content"]{菜单项$} -->
  36. <li>
  37. <a href="/19期/作业/18day-1.html" target="content">菜单项1</a>
  38. </li>
  39. <li>
  40. <a href="/19期/HTML/2-2链接与列表.html" target="content"
  41. >菜单项2</a
  42. >
  43. </li>
  44. <li>
  45. <a href="/19期/HTML/3-1input表单.HTML" target="content"
  46. >菜单项3</a
  47. >
  48. </li>
  49. <li>
  50. <a
  51. href="/19期/HTML/3-2iframe内联框架标签与多媒体.HTML"
  52. target="content"
  53. >菜单项4</a
  54. >
  55. </li>
  56. <li>
  57. <a href="/19期/作业/18day-2.html" target="content">菜单项5</a>
  58. </li>
  59. </ul>
  60. </div>
  61. </div>
  62. <!-- 右侧内容区 -->
  63. <iframe
  64. src=""
  65. frameborder="1"
  66. name="content"
  67. width="1200px"
  68. height="600px"
  69. ></iframe>
  70. <br />
  71. <br />
  72. </div>
  73. <!-- 底部 -->
  74. <div style="background-color: rgb(8, 139, 226); height: 50px"></div>
  75. </body>
  76. </html>

示例效果展示


三、元素样式来源、优先级

1 元素样式来源

  • 代理样式/浏览器样式/默认样式
  • 自定义样式 ,会覆盖默认样式

注:某些属性具有继承特征,例如颜色、字体、字号、子元素会继承父元素的同名属性
并非所有属性都可以继承,例如盒模型的属性就不能继承
总体来说,样式来源就二类

自定义的:装修

2 优先级

  • 默认样式:继承自 html
  • 自定义样式 1:行内样式 style 属性
  • 自定义样式 2:文档样式/内部样式,style 标签
  • 自定义样式 3:外部样式,css 文档

如下

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <title>Document</title>
  8. </head>
  9. <body>
  10. <!-- 所有默认样式清零 -->
  11. <!-- <style>
  12. *{
  13. margin: 0;
  14. padding: 0;
  15. }
  16. /* </style> */ -->
  17. <!-- 来源1:代理样式/浏览器样式/默认样式 -->
  18. <h1>hello</h1>
  19. <!-- 来源2:自定义样式 ,会覆盖默认样式-->
  20. <h1 style="color: brown;">world</h1>
  21. <!-- 来源3:书写顺序,写在后面的同名属性会覆盖前面的(优先级相同的情况下) -->
  22. <div>
  23. <!-- 某些属性具有继承特征,例如颜色、字体、字号、子元素会继承父元素的同名属性 -->
  24. <h1 style="color: aquamarine;">php.cn</h1>
  25. </div>
  26. <div>
  27. <a href="">php中文网</a>
  28. </div>
  29. <!-- 并非所有属性都可以继承,例如盒模型的属性就不能继承 -->
  30. <!-- 总体来说,样式来源就二类
  31. 1.默认的:毛坯
  32. 2.自定义的:装修 -->
  33. </body>
  34. </html>
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