Blogger Information
Blog 7
fans 0
comment 0
visits 5441
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
简单的登陆表单、后台框架、元素样式来源与优先级
Original
362 people have browsed it

一、登陆表单

  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. <!-- method 数据提交方式:get(不安全)和post -->
  11. <form action="check.php" method="get">
  12. <div>
  13. <label for="username">用户名:</label>
  14. <input type="text" id="username" name="username" value="" placeholder="至少8位" autofocus required>
  15. </div>
  16. <div>
  17. <label for="psw">密&nbsp;&nbsp;&nbsp;码:</label>
  18. <input type="password" id="psw" name="password" value="" placeholder="数字+字母">
  19. </div>
  20. <div>
  21. <label for="my-email">邮&nbsp;&nbsp;&nbsp;箱:</label>
  22. <input type="email" id="my-email" name="email" value="" placeholder="a@email.com" required>
  23. </div>
  24. <div>
  25. <!-- 所有的input.name 相同才可以进行单选 -->
  26. <label for="male">性别:</label>
  27. <input type="radio" name="gender" value="男" id="male">
  28. <label for="male"></label>
  29. <input type="radio" name="gender" value="女" id="female" checked>
  30. <label for="female"></label>
  31. </div>
  32. <div>
  33. <!-- 复选框(所有的input.name 数组形式) -->
  34. <label for="male">兴趣:</label>
  35. <input type="checkbox" name="hobbies[]" value="游戏" id="game" checked>
  36. <label for="game">游戏</label>
  37. <input type="checkbox" name="hobbies[]" value="音乐" id="music">
  38. <label for="music">音乐</label>
  39. <input type="checkbox" name="hobbies[]" value="健身" id="fitness">
  40. <label for="fitness">健身</label>
  41. <input type="checkbox" name="hobbies[]" value="摄影" id="Photography">
  42. <label for="Photography">摄影</label>
  43. </div>
  44. <div>
  45. <!-- 多选框:(selected:默认值) -->
  46. <label for="province">省份</label>
  47. <select name="" id="province">
  48. <option value="1">福建</option>
  49. <option value="2" selected>浙江</option>
  50. <option value="3">江西</option>
  51. <option value="4">广东</option>
  52. </select>
  53. </div>
  54. <div>
  55. <button>提交</button>
  56. </div>
  57. </form>
  58. </body>
  59. </html>

前端演示:
前端演示

php服务端接值演示:
php端接值

二、<iframe>后台框架

  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. <style>
  9. body {
  10. height: 100vh;
  11. width: 100vw;
  12. display: grid;
  13. grid-template-columns: 10em 1fr;
  14. grid-template-rows: 6em 1fr;
  15. margin: 0;
  16. }
  17. body .header {
  18. grid-column-end: span 2;
  19. border-bottom: 1px solid currentColor;
  20. background-color: #efe;
  21. padding: 2em;
  22. display: flex;
  23. align-items: center;
  24. }
  25. body .header div {
  26. margin-left: auto;
  27. }
  28. body .nav {
  29. background-color: #efc;
  30. margin: 0;
  31. padding-top: 1em;
  32. list-style: none;
  33. }
  34. body iframe {
  35. width: calc(100vw - 10em);
  36. height: calc(100vh - 6em);
  37. border-left: 1px solid currentColor;
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <div class="header">
  43. <h1>管理后台</h1>
  44. <div>
  45. <span>admin</span>
  46. <a href="">退出</a>
  47. </div>
  48. </div>
  49. <ul class="nav">
  50. <li><a href="work1.html" target="content">菜单项1</a></li>
  51. <li><a href="work1.html" target="content">菜单项2</a></li>
  52. <li><a href="work1.html" target="content">菜单项3</a></li>
  53. <li><a href="work1.html" target="content">菜单项4</a></li>
  54. <li><a href="work1.html" target="content">菜单项5</a></li>
  55. </ul>
  56. <iframe src="" frameborder="1" name="content"></iframe>
  57. </body>
  58. </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>Document</title>
  8. <style>
  9. .ys {
  10. color: blue;
  11. }
  12. .important-class{
  13. color: green !important;
  14. }
  15. </style>
  16. <link rel="stylesheet" href="static/work3.css">
  17. </head>
  18. <body>
  19. <!-- 1.来源样式/浏览器样式/代理样式-->
  20. <h2>1、默认:黑色</h2>
  21. <!-- 2.自定义样式会覆盖默认样式 -->
  22. <h2 style="color: red;">2、通过内置style变成红色</h2>
  23. <!-- 3.书写顺序,同名属性会被后面覆盖(优先级相同情况) -->
  24. <h2 style="color: red; color:blue;;">3、后写的蓝色会覆盖红色</h2>
  25. <!-- 4.继承 -->
  26. <div style="color: red;">
  27. <!-- 某些属性会继承特征,如颜色、字体等 -->
  28. <h1>4、h1从div继承红色</h1>
  29. </div>
  30. <!-- 5.<a>标签默认有属于自己的颜色,也可自定义 -->
  31. <div style="color: brown;">
  32. <a href="">5、当A链接有自己的颜色时,不继承</a>
  33. </div>
  34. <!-- 注意盒模型的属性不能继承 -->
  35. <!-- 来源样式
  36. 1.默认样式
  37. 2.自定义样式{
  38. 1.行内样式: style属性
  39. 2.文档样式/内部样式:style标签
  40. 3.外部样式:css文档
  41. }
  42. -->
  43. <hr>
  44. <hr>
  45. <!-- 1.行内样式: style属性 -->
  46. <div style="color: red;">1、行内样式: style属性</div>
  47. <!-- 2.文档样式/内部样式:style标签 -->
  48. <div class="ys">2、内部样式:style标签</div>
  49. <!-- 3.外部样式:css文档 -->
  50. <div class="ys1">3、内外部样式:css文档,通过link标签或@import方法引入css文件,否则不起作用</div>
  51. <hr>
  52. <!-- 4.内联样式:style属性 -->
  53. <div class="content-class" id="content-id" style="color: black">
  54. 4、优先级关系:内联样式 > ID 选择器 > 类选择器 = 属性选择器 = 伪类选择器 > 标签选择器 = 伪元素选择器
  55. <p> 4.1、最终的 color 为 black,因为内联样式比其他选择器的优先级高</p>
  56. </div>
  57. <!-- 5.调试模式:style属性值加 !important -->
  58. <div id="content-id" class="content-class important-class">
  59. 5、调试模式的 color 为 green,因为调试模式的样式比所有的选择器的优先级高
  60. </div>
  61. </body>
  62. </html>
  63. |-----------------------css文件内容(static/work3.css)------------|
  64. -------------------------------work3.css内容 开始-------------------
  65. .ys1 {
  66. color: blueviolet;
  67. }
  68. #content-id {
  69. color: red;
  70. }
  71. .content-class {
  72. color: blue;
  73. }
  74. div {
  75. color: grey;
  76. }
  77. ------------------------------work3.css内容 结束-------------------

演示:
css演示

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